Skip to main content
All CollectionsAPIs
Making an API Request
Making an API Request

API Usage & Authentication

Raunaq Singh avatar
Written by Raunaq Singh
Updated over a month ago

API Endpoint

All of our data APIs can be used

GET https://data.unwrangle.com/api/getter/

โ›“๏ธโ€๐Ÿ’ฅPlease note that the trailing slash in the endpoint is necessary for optimal performance. The request will be routed via a 301 when the trailing slash isn't present. This could have a negligible an impact on the speed of the response, but an impact nonetheless

Authentication

There are 2 ways to authenticate your requests to our APIs

  1. With Authorization header:

    'Authorization': 'Token <your_api_key>'

  2. With query parameter:

    &api_key=<your_api_key>

Platform

The query parameter platform can be used to select the API you wish to use. Read the docs to find a list of all supported platforms.

Depending on the platform selected, query params such as search or url and page can be used to scrape the desired data from the selected platform.

Here's an example of a request to fetch latest results for 'bose qc 45' with Amazon Search API:
โ€‹

GET https://data.unwrangle.com/api/getter/?platform=amazon_search&country_code=us&search=bose+qc+45&api_key=<your_api_key>

Encoding

The values of the query params used to specify the search keyword or url that needs to be scraped should be encoded in utf-8 character set.

โœ๐Ÿผ Note: it isn't necessary to encode inputs when using the console.

Example for Search

When using any Search API, the query parameter search is used to define keyword for the search query.

After encoding search keyword "bose qc 45" will become:
โ€‹

Option 1:

&search=bose+qc+45

Option 2:

&search=bose%20qc%2045

Example for URL

When using any Reviews API to fetch reviews for a product listing or using any Detail API to fetch product data for a product listing, the query parameter url is used to define the target for the scrape.

โŒ Before encoding:

platform=amazon_reviews&url=https://www.amazon.com/Black-Decker-BPWM09W-Portable-Washer/dp/B0799Q45TT&page=1

โœ… After encoding:

platform=amazon_reviews&url=https%3A%2F%2Fwww.amazon.com%2FBlack-Decker-BPWM09W-Portable-Washer%2Fdp%2FB0799Q45TT&page=1

Pagination

For all APIs that scrape paginated data (for e.g. Reviews APIs and Search APIs), the query parameter page is used to define the page number for the scrape.

A few platforms for e.g. amazon_reviews have page limits due restrictions on the site. If an invalid page number is supplied you will get a response code 400 or 500.

Response Codes

The response codes indicate the status of the scrape.

Success

Response code 200 indicates a successful scrape.

Error

Response code 504 indicates an error in the scrape. There are 3 possible reason for a 504:

  1. Invalid input

  2. Blocked or detected

  3. Parsing error

If you get a 504 more than once, please check if the input is valid for e.g. if the url exists. If it does and you're still getting a 504, please get in touch with us and we'll fix the issue causing it.
โ€‹

Response code 500 or 502 indicates an error on our service. If there is any such occurence, please notify us immediately at [email protected]
โ€‹

Bad Request

Response code 400 indicates an invalid request with incorrect input. In this case, please refer to the docs page for the API you are trying to use and make correction to your request as necessary.

Response code 403 indicates an authentication error. This happens in the event that value of the API key you are passing is incorrect or the credits in your account as exhausted.

Error Handling & Retries

We monitor the API to ensure errors occur at a minimum. However, due to the nature of scraping on the occasion that an error does occur we recommend retrying requests up to 5 times in case of failure.

If an issue persists, please reach out to us at [email protected]. If any of your requests face errors, you will receive a weekly "Recent errors" update via email describing the error and our resolution for it.

When a new platform is added or a new type of product is parsed for the first time, there maybe cases that our parser hasn't encountered yet and that will lead to an error. We diligently monitor logs and make necessary updates and send out a "Recent errors" notification via email with our resolution for all errors.

Credits

The number of credits deducted depends on the API being used, you can find this information on each API's docs page here.

No credits are deducted for failed or invalid requests.

Did this answer your question?