Using the Product Advertising API Scratchpad
Once you've signed up for Associates Program and Product Advertising API, you can start playing around with the API using Product Advertising API Scratchpad. Use the tool to submit requests to the Product Advertising API and get response. The Scratchpad tool returns sample code in several languages to help you understand how the Product Advertising API works and helps you integrate with ease.
This section is a brief user guide of Product Advertising API 5.0 Scratchpad. You'll find the current version of scratchpad here. Scratchpad is hosted at all the supported locales separately. Using the following Locale Reference Table, choose the Product Advertising API 5.0 Scratchpad URL for the locale that you want.
Take the Tour
You can get a quick tour of scratchpad by heading over to the tool and clicking on Start Tour on top right section of the navigation header. Use the Locale Reference Table below to choose the Scratchpad URL for the target locale.
Submitting a Request
Choose an operation from the left panel (for example,
Under Common parameters, enter the following information (For information on common parameters, refer Common Request Parameters):
Create a request by entering details under Request Parameters.
Popular parameters corresponding to an operation are already displayed in this panel.
However, an operation may have more parameters which can be added using Add a new Parameter and hitting the + icon. For list of valid parameters for an operation, refer Operations under API Reference.
Resources determine what information will be returned in the API response. Add resources by selecting from valid list of resources for the operation. For more information on resources, refer Resources.
Choose Run request.
If your request is successful, you'll see the raw API response in JSON Response tab under the Response Section.
To start over, choose Reset form.
- On a successful request, the scratchpad displays following information as response:
- Rendered Response: The way response appears on a webpage. This is created using a HTML/CSS template and focuses on displaying some popular elements from the API response.
- JSON Response: The raw API response in JSON format.
- HTML Response: The HTML+CSS code for the rendered response. You can copy this using the Copy button situated at top-right of the section.
- To save the response, click on Save response and the response will be saved in a text file containing request and response information.
- Scratchpad also returns cooked-up code snippets in JAVA, PHP and cURL based on the request. You can directly consume these code snippets to ease your integration with Product Advertising API. For example, copy the
curlsnippet to clipboard and paste it in the terminal to see API response.
- To download a copy of any code snippet, click on Save code.
- You can also copy the code snippets onto clipboard by clicking the Copy button.
Modifying a Request
You can modify a request in two ways:
- Under the Request parameters section, choose the + icon to add parameters or the x icon to remove them. Once you've modified the request, choose Run request.
- Under the JSON Payload section inside the
Request Detailspanel, type your changes to the JSON payload by modifying/adding/removing parameters. Once you've made changes to the JSON payload, choose Extract parameters and run request. Your new response appears below. The
Request detailssections are updated to match your new request.
Scratchpad will save your 10 most recent requests. The history displays each operation, locale, and the parameters you chose. Use the history to switch between previous requests and compare the different inputs. To work with history feature, follow the steps mentioned below:
- From the right corner, choose History.
- Choose the request you want.
- Scratchpad will refresh and return the request for you.
- To clear your history, choose Clear History.
- If you get a response error, try inferring the response error message and take action by changing your parameters and values if need be. For reference, see Troubleshooting.
- The tool features front-end validation on request parameters, helping you fire request with valid parameter values. Whenever an invalid value is entered into a request parameter, the tool flags it as red. For instance, the SearchItems parameter
BrowseNodeIdaccepts only positive integers as input, hence, supplying alphabets to it will flag the parameter as red. For reference, see the image below: Correcting its value with numbers will make it green again:
- Copy to clipboard button is provided throughout the tool for users to be able to copy content to clipboard easily.
- In the response section, a full-screen viewing option next to
Copybutton is also provided for better readability of large responses.
- Choose Support on top right of the navigation bar to report an issue or locate links to the API documentation and discussion forum.