Skip to Main Content
Amazon Hacks
book

Amazon Hacks

by Paul Bausch
August 2003
Intermediate to advanced content levelIntermediate to advanced
304 pages
7h 33m
English
O'Reilly Media, Inc.
Content preview from Amazon Hacks

View XML Responses in a Browser

Here’s a quick way of testing XML/HTTP responses to make sure you’re getting the data you need.

One great thing about the XML/HTTP method of retrieving data from Amazon is that it’s easy to read the responses and know what you’re getting. Instead of relying on tools to parse the response, you can usually see exactly what data you’re working with by looking it at yourself.

This is where a browser that can display XML comes in handy. Because the requests are made with a URL over HTTP, requesting XML data is just like requesting a web page. If you’re ever puzzled by the results you’re getting from an XML/HTTP script, this is a great way to debug. Just copy the URL from your code (this may require writing the URL out to the page if you’re dynamically generating the URL) and paste it into your browser’s address field.

Tip

Some browsers are better than others at displaying XML in a human-readable form. Internet Explorer builds a nice tree outline and allows you to hide or show particular branches. Other browsers display the XML in plain text exactly as it appears in the response. Still others show a blank page, leaving you to “view the source” to see the XML.

Let’s take a simple product detail query:

http://xml.amazon.com/onca/xml3?t=insert associate tag 
            [RETURN]
            &dev-t=insert developer token&type=lite&f=xml&AsinSearch=0596005423

Paste this into the Address field of Internet Explorer, and you should see something like Figure 6-1.

Figure 6-1. Amazon “lite” XML ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

From ChatGPT to HackGPT: Meeting the Cybersecurity Threat of Generative AI

From ChatGPT to HackGPT: Meeting the Cybersecurity Threat of Generative AI

Karen Renaud, Merrill Warkentin, George Westerman
Incident Metrics in SRE

Incident Metrics in SRE

Stepan Davidovic

Publisher Resources

ISBN: 0596005423Supplemental ContentCatalog PageErrata