### Request Product Details using Node.js Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/product This Node.js example uses the `axios` library to make an HTTP GET request to the Rainforest API for product details. Ensure `axios` is installed (`npm install axios`). ```javascript const axios = require('axios'); // set up the request parameters const params = { api_key: "demo", type: "product", amazon_domain: "amazon.com", asin: "B073JYC4XM" } // make the http GET request to Rainforest API axios.get('https://api.rainforestapi.com/request', { params }) .then(response => { // print the JSON response from Rainforest API console.log(JSON.stringify(response.data, 0, 2)); }).catch(error => { // catch and print the error console.log(error); }) ``` -------------------------------- ### Start a Collection via Rainforest API Source: https://docs.trajectdata.com/rainforestapi/collections-api/collections/start Examples of triggering a collection start for a specific collection ID using various programming languages and tools. ```HTTP https://api.rainforestapi.com/collections/123456/start?api_key=demo ``` ```curl $ curl "https://api.rainforestapi.com/collections/123456/start?api_key=demo" ``` ```nodejs const axios = require('axios'); const params = { api_key: 'demo' } axios.get('https://api.rainforestapi.com/collections/123456/start', { params }) .then(response => { const apiResponse = response.data; console.log('Collection started.'); }).catch(error => { console.log(error); }); ``` ```python import requests params = { 'api_key': 'demo' } api_result = requests.get('https://api.rainforestapi.com/collections/123456/start', params) api_response = api_result.json() print "Collection started." ``` ```php 'demo', ]); $ch = curl_init(sprintf('%s?%s', 'https://api.rainforestapi.com/collections/123456/start', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); # the following options are required if you're using an outdated OpenSSL version # more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 180); $json = curl_exec($ch); curl_close($ch); $api_result = json_decode($json, true); print_r($api_result); echo "Collection started.", PHP_EOL; ?> ``` -------------------------------- ### Construct HTTP GET Request Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/common Example of constructing a GET request with common parameters for the Rainforest API. ```HTTP https://api.rainforestapi.com/request?api_key=demo&type=reviews&amazon_domain=amazon.com&asin=B073JYC4XM&review_stars=all_critical ``` -------------------------------- ### Make API Request using Node.js Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/common Example of making an HTTP GET request to the Rainforest API using Node.js and the axios library. Ensure axios is installed. ```javascript const axios = require('axios'); // set up the request parameters const params = { api_key: "demo", type: "reviews", amazon_domain: "amazon.com", asin: "B073JYC4XM", review_stars: "all_critical" } // make the http GET request to Rainforest API axios.get('https://api.rainforestapi.com/request', { params }) .then(response => { // print the JSON response from Rainforest API console.log(JSON.stringify(response.data, 0, 2)); }).catch(error => { // catch and print the error console.log(error); }) ``` -------------------------------- ### Product Information Example Source: https://docs.trajectdata.com/rainforestapi/product-data-api/results/search This snippet shows an example of product data returned by the Rainforest API, detailing pricing, ratings, and other attributes. ```APIDOC ## Product Data Structure This section details the structure of product data returned by the API. ### Fields - **name** (string) - The name of the product. - **id** (string) - A unique identifier for the product. - **image** (string) - URL of the product image. - **bestseller** (object) - Information about the product's bestseller status. - **link** (string) - Link to the bestseller list. - **category** (string) - The category the product is a bestseller in. - **deal** (object) - Information about any deals on the product. - **link** (string) - Link to the deal. - **badge_text** (string) - Text displayed on the deal badge. - **unit_price** (string) - The unit price of the product (e.g., "$1.12/Ounce"). - **is_prime** (boolean) - Indicates if the product is eligible for Amazon Prime. - **is_amazon_fresh** (boolean) - Indicates if the product is available via Amazon Fresh. - **is_whole_foods_market** (boolean) - Indicates if the product is from Whole Foods Market. - **rating** (number) - The average customer rating. - **ratings_total** (number) - The total number of customer ratings. - **is_carousel** (boolean) - Indicates if the product is part of a carousel. - **carousel** (object) - Details about the carousel if `is_carousel` is true. - **title** (string) - The title of the carousel. - **id** (string) - The ID of the carousel. - **total_items** (number) - The total number of items in the carousel. - **sponsored** (boolean) - Indicates if the product is sponsored. - **below_use_fewer_words_banner** (boolean) - Indicates if a specific banner is displayed. - **prices** (array) - An array of price objects for the product. - **symbol** (string) - Currency symbol (e.g., "$"). - **value** (number) - The price value. - **currency** (string) - The currency code (e.g., "USD"). - **raw** (string) - The raw price string (e.g., "$13.99"). - **name** (string) - The name associated with the price (e.g., "Limited time deal"). - **is_primary** (boolean) - Indicates if this is the primary price. - **list_price** (string) - The list price of the item. - **link** (string) - A link associated with this price. - **is_rrp** (boolean) - Indicates if this is the Recommended Retail Price. - **asin** (string) - The ASIN of the product. - **price** (object) - The primary price object for the product. - **symbol** (string) - Currency symbol (e.g., "$"). - **value** (number) - The price value. - **currency** (string) - The currency code (e.g., "USD"). - **raw** (string) - The raw price string (e.g., "$13.99"). - **name** (string) - The name associated with the price (e.g., "Limited time deal"). - **is_primary** (boolean) - Indicates if this is the primary price. - **list_price** (string) - The list price of the item. - **link** (string) - A link associated with this price. ### Example Response Snippet ```json { "name": "Rip Van Chocolate Hazelnut Cookies", "id": "B09BBMBZZN", "image": "https://m.media-amazon.com/images/I/815fvtbx8+L._AC_UL320_.jpg", "bestseller": { "link": "https://www.amazon.com/sspa/click?...", "category": "Wafer Cookies" }, "deal": { "link": "https://www.amazon.com/gp/goldbox/", "badge_text": "Limited time deal" }, "unit_price": "$1.12$1.12/Ounce", "is_prime": true, "is_amazon_fresh": false, "is_whole_foods_market": false, "rating": 4, "ratings_total": 17982, "is_carousel": true, "carousel": { "title": "Valentine's deals", "id": "loom-desktop-inline-slot_sptw-hve-deals-blended-inline", "total_items": 4 }, "sponsored": true, "below_use_fewer_words_banner": true, "prices": [ { "symbol": "$", "value": 13.99, "currency": "USD", "raw": "$13.99", "name": "Limited time deal", "is_primary": true, "list_price": "$1.12", "link": "https://www.amazon.com/sspa/click?..." }, { "symbol": "$", "value": 21.99, "currency": "USD", "raw": "$21.99", "name": "Limited time deal", "is_rrp": true, "link": "https://www.amazon.com/sspa/click?...", "asin": "B09BBMBZZN" } ], "price": { "symbol": "$", "value": 13.99, "currency": "USD", "raw": "$13.99", "name": "Limited time deal", "is_primary": true, "list_price": "$1.12", "link": "https://www.amazon.com/sspa/click?..." } } ``` ``` -------------------------------- ### Make API Request using Python Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/common Example of making an HTTP GET request to the Rainforest API using Python's requests library. Ensure the requests library is installed. ```python import requests import json # set up the request parameters params = { 'api_key': 'demo', 'type': 'reviews', 'amazon_domain': 'amazon.com', 'asin': 'B073JYC4XM', 'review_stars': 'all_critical' } # make the http GET request to Rainforest API api_result = requests.get('https://api.rainforestapi.com/request', params) # print the JSON response from Rainforest API print(json.dumps(api_result.json())) ``` -------------------------------- ### Request Product Details using PHP Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/product This PHP example demonstrates making an HTTP GET request to the Rainforest API using cURL to retrieve product details. It constructs the query string and sets cURL options for the request. ```php 'demo', 'type' => 'product', 'amazon_domain' => 'amazon.com', 'asin' => 'B073JYC4XM' ]); # make the http GET request to Rainforest API $ch = curl_init(sprintf('%s?%s', 'https://api.rainforestapi.com/request', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); # the following options are required if you're using an outdated OpenSSL version # more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 180); $api_result = curl_exec($ch); curl_close($ch); # print the JSON response from Rainforest API echo $api_result; ?> ``` -------------------------------- ### Get CSV Download Links (Python) Source: https://docs.trajectdata.com/rainforestapi/collections-api/requests/list Python example using the requests library to retrieve CSV download links for collection requests. ```python import requests params = { 'api_key': 'demo' } api_result = requests.get('https://api.rainforestapi.com/collections/123456/requests/csv', params) api_response = api_result.json() ``` -------------------------------- ### List All Collections (Node.js) Source: https://docs.trajectdata.com/rainforestapi/collections-api/collections/list This Node.js example uses the 'axios' library to make a GET request to the collections endpoint. It logs the total number of collections and the name of each collection. Error handling for the request is included. ```javascript const axios = require('axios'); const params = { api_key: 'demo' } axios.get('https://api.rainforestapi.com/collections?api_key=demo') .then(response => { const apiResponse = response.data; console.log("Total Collections: ", apiResponse.total_count); apiResponse.collections.map((collection, number) => console.log((number + 1) + '. ' + collection.name); }).catch(error => { console.error(error); }); ``` -------------------------------- ### Get CSV Download Links (Node.js) Source: https://docs.trajectdata.com/rainforestapi/collections-api/requests/list Node.js example using the axios library to make a GET request for CSV download links of collection requests. ```javascript const axios = require('axios'); const params = { api_key: 'demo' } axios.get('https://api.rainforestapi.com/collections/123456/requests/csv', { params }) .then(response => { const apiResponse = response.data; }).catch(error => { console.log(error); }); ``` -------------------------------- ### Get CSV Download Links (cURL) Source: https://docs.trajectdata.com/rainforestapi/collections-api/requests/list Command-line example using cURL to fetch CSV download links for requests associated with a collection. ```curl $ curl "https://api.rainforestapi.com/collections/123456/requests/csv?api_key=demo" ``` -------------------------------- ### Get CSV Download Links (HTTP) Source: https://docs.trajectdata.com/rainforestapi/collections-api/requests/list Example of how to construct the URL to retrieve CSV download links for requests within a collection. ```http https://api.rainforestapi.com/collections/123456/requests/csv?api_key=demo ``` -------------------------------- ### Get Account Information (PHP) Source: https://docs.trajectdata.com/rainforestapi/account-api Use PHP with cURL to get account information. Build the query string with your `api_key` and make a GET request to the /account endpoint. Note the SSL verification options for older OpenSSL versions. ```php 'demo' ]); # make the http GET request to Rainforest API $ch = curl_init(sprintf('%s?%s', 'https://api.rainforestapi.com/account', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); # the following options are required if you're using an outdated OpenSSL version # more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 180); $api_result = curl_exec($ch); curl_close($ch); # print the JSON response from Rainforest API echo $api_result; ?> ``` -------------------------------- ### Get Account Information (Python) Source: https://docs.trajectdata.com/rainforestapi/account-api Fetch account details using Python with the `requests` library. Define your `api_key` in the params dictionary and perform a GET request. ```python import requests import json # set up the request parameters params = { 'api_key': 'demo' } # make the http GET request to Rainforest API api_result = requests.get('https://api.rainforestapi.com/account', params) # print the JSON response from Rainforest API print(json.dumps(api_result.json())) ``` -------------------------------- ### GET /offers Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/offers Parameters for retrieving product offers when type=offers is specified. ```APIDOC ## GET /offers ### Description Retrieve product offers from Amazon using various identification methods and filtering options. ### Method GET ### Parameters #### Query Parameters - **amazon_domain** (string) - Optional - The Amazon domain to retrieve offers from. - **asin** (string) - Optional - The Amazon ASIN (product ID) to retrieve offers for. - **gtin** (string) - Optional - A GTIN, ISBN, UPC or EAN code to retrieve results for. - **skip_gtin_cache** (boolean) - Optional - Force a new GTIN lookup, bypassing the 2-month cache. - **url** (string) - Optional - The Amazon product-page URL to retrieve offers from. - **offers_prime** (boolean) - Optional - Limit offers to those that are Prime-eligible. - **offers_free_shipping** (boolean) - Optional - Limit offers to those that have Free Shipping. ``` -------------------------------- ### Product Listing Example Source: https://docs.trajectdata.com/rainforestapi/product-data-api/results/search This snippet demonstrates how multiple products might be listed, including their position and title. ```APIDOC ## Product Listing This section shows an example of how products are listed, including their order and title. ### Fields - **position** (number) - The position of the product in the list. - **title** (string) - The full title of the product. - **asin** (string) - The ASIN (Amazon Standard Identification Number) of the product. ### Example Product Entry ```json { "position": 9, "title": "Kinder Bueno Mini, 125 Count Party Pack, Milk Chocolate and Hazelnut Cream, Individually Wrapped Chocolate Bars, 23.8 oz", "asin": "B0CD31YXQB" } ``` ``` -------------------------------- ### Request Seller Products via API Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/seller-products Examples of how to construct a request for seller product listings using various programming languages and tools. ```HTTP https://api.rainforestapi.com/request?api_key=demo&type=seller_products&seller_id=A02211013Q5HP3OMSZC7W&amazon_domain=amazon.com ``` ```curl curl -L --get https://api.rainforestapi.com/request \ -d api_key="demo" \ -d type="seller_products" \ -d seller_id="A02211013Q5HP3OMSZC7W" \ -d amazon_domain="amazon.com" ``` ```nodejs const axios = require('axios'); // set up the request parameters const params = { api_key: "demo", type: "seller_products", seller_id: "A02211013Q5HP3OMSZC7W", amazon_domain: "amazon.com" } // make the http GET request to Rainforest API axios.get('https://api.rainforestapi.com/request', { params }) .then(response => { // print the JSON response from Rainforest API console.log(JSON.stringify(response.data, 0, 2)); }).catch(error => { // catch and print the error console.log(error); }) ``` ```python import requests import json # set up the request parameters params = { 'api_key': 'demo', 'type': 'seller_products', 'seller_id': 'A02211013Q5HP3OMSZC7W', 'amazon_domain': 'amazon.com' } # make the http GET request to Rainforest API api_result = requests.get('https://api.rainforestapi.com/request', params) # print the JSON response from Rainforest API print(json.dumps(api_result.json())) ``` ```php 'demo', 'type' => 'seller_products', 'seller_id' => 'A02211013Q5HP3OMSZC7W', 'amazon_domain' => 'amazon.com' ]); # make the http GET request to Rainforest API $ch = curl_init(sprintf('%s?%s', 'https://api.rainforestapi.com/request', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); # the following options are required if you're using an outdated OpenSSL version # more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 180); $api_result = curl_exec($ch); curl_close($ch); # print the JSON response from Rainforest API echo $api_result; ?> ``` -------------------------------- ### Include All Book Formats Parameter Source: https://docs.trajectdata.com/rainforestapi/product-updates When using the `type=product` endpoint for a book ASIN, include this parameter to retrieve all available formats and editions. Note that credit consumption scales with the number of formats returned. ```json "include_all_book_formats": true ``` -------------------------------- ### Retrieve Product Questions via Rainforest API Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/questions Examples of how to request product questions using various programming languages and tools. ```HTTP https://api.rainforestapi.com/request?api_key=demo&type=questions&page=1&amazon_domain=amazon.com&asin=B073JYC4XM&search_term=gb ``` ```curl curl -L --get https://api.rainforestapi.com/request \ -d api_key="demo" \ -d type="questions" \ -d page="1" \ -d amazon_domain="amazon.com" \ -d asin="B073JYC4XM" \ -d sort_by="most_helpful" ``` ```nodejs const axios = require('axios'); // set up the request parameters const params = { api_key: "demo", type: "questions", page: "1", amazon_domain: "amazon.com", asin: "B073JYC4XM", sort_by: "most_helpful" } // make the http GET request to Rainforest API axios.get('https://api.rainforestapi.com/request', { params }) .then(response => { // print the JSON response from Rainforest API console.log(JSON.stringify(response.data, 0, 2)); }).catch(error => { // catch and print the error console.log(error); }) ``` ```python import requests import json # set up the request parameters params = { 'api_key': 'demo', 'type': 'questions', 'page': '1', 'amazon_domain': 'amazon.com', 'asin': 'B073JYC4XM', 'sort_by': 'most_helpful' } # make the http GET request to Rainforest API api_result = requests.get('https://api.rainforestapi.com/request', params) # print the JSON response from Rainforest API print(json.dumps(api_result.json())) ``` ```php 'demo', 'type' => 'questions', 'page' => '1', 'amazon_domain' => 'amazon.com', 'asin' => 'B073JYC4XM', 'sort_by' => 'most_helpful' ]); # make the http GET request to Rainforest API $ch = curl_init(sprintf('%s?%s', 'https://api.rainforestapi.com/request', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); # the following options are required if you're using an outdated OpenSSL version # more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 180); $api_result = curl_exec($ch); curl_close($ch); # print the JSON response from Rainforest API echo $api_result; ?> ``` -------------------------------- ### Add Zipcodes via Node.js Source: https://docs.trajectdata.com/rainforestapi/zipcodes-api/add This Node.js example uses the axios library to send a POST request to add zipcodes. Ensure you have axios installed (`npm install axios`). ```javascript const axios = require('axios'); const body = [ { 'zipcode': '10550', 'domain': 'amazon.com' } ]; axios.post('https://api.rainforestapi.com/zipcodes?api_key=demo', body) .then(response => { const apiResponse = response.data; console.log('Zipcodes Added: ' + JSON.stringify(apiResponse, 0, 2)); }).catch(error => { console.log(error); }); ``` -------------------------------- ### Full Product Data API Request with GTIN Source: https://docs.trajectdata.com/rainforestapi/product-data-api/reference/gtin-upc-ean-to-asin This is a complete HTTP request example for looking up product data using a GTIN. The `api_key` and `amazon_domain` are crucial parameters. ```http https://api.rainforestapi.com/request?api_key=demo&type=product&amazon_domain=amazon.co.uk>in=5702015866637 ``` -------------------------------- ### Delete Destination using Node.js Source: https://docs.trajectdata.com/rainforestapi/destinations-api/delete This Node.js example uses the axios library to make an HTTP DELETE request to the /destinations/DESTINATION_ID endpoint. Ensure you have axios installed (`npm install axios`). ```javascript const axios = require('axios'); const params = { api_key: 'demo' } axios.delete('https://api.rainforestapi.com/destinations/ABCDEFG', { params }) .then(response => { console.log('Destination deleted.'); }).catch(error => { console.log(error); }); ``` -------------------------------- ### List All Collections (cURL) Source: https://docs.trajectdata.com/rainforestapi/collections-api/collections/list This cURL command demonstrates how to fetch all collections from your account. Ensure you replace 'demo' with your actual API key. The response includes the total count and a list of collections. ```curl $ curl "https://api.rainforestapi.com/collections?api_key=demo" ``` -------------------------------- ### JSON Response for Seller Products Source: https://docs.trajectdata.com/rainforestapi/product-data-api/results/seller-products Example of the JSON structure returned when querying for seller products. ```json { "request_info": { "success": true, "credits_used": 1, "credits_remaining": 999 }, "request_metadata": { "id": "48d63ef58b3eb240d5b18115b674c4170faba51f", "created_at": "2020-01-01T00:00:00.000Z", "processed_at": "2020-01-01T00:00:00.001Z", "total_time_taken": 0.1, "amazon_url": "https://www.amazon.com/s?me=A02211013Q5HP3OMSZC7W" }, "request_parameters": { "type": "seller_products", "seller_id": "A02211013Q5HP3OMSZC7W", "amazon_domain": "amazon.com" }, "seller_products": [ { "position": 1, "title": "SanDisk 128GB Ultra Fit USB 3.1 Flash Drive - SDCZ430-128G-G46", "asin": "B07855LJ99", "link": "https://www.amazon.com/dp/B07855LJ99", "categories": [ { "name": "MemoryWhiz" } ], "image": "https://m.media-amazon.com/images/I/61+pA9gUKEL._AC_UY218_.jpg", "is_prime": false, "rating": 4.6, "ratings_total": 36518, "sponsored": false, "prices": [ { "symbol": "$", "value": 18.94, "currency": "USD", "raw": "$18.94", "name": "Personal Computers" } ], "price": { "symbol": "$", "value": 18.94, "currency": "USD", "raw": "$18.94", "name": "Personal Computers" } }, { "position": 2, "title": "SanDisk 128GB Cruzer Glide CZ60 USB 2.0 Flash Drive - SDCZ60-128G-B35,Black/Red", "asin": "B007YX9OGW", "link": "https://www.amazon.com/dp/B007YX9OGW", "categories": [ { "name": "MemoryWhiz" } ], "image": "https://m.media-amazon.com/images/I/710dWgbaGuL._AC_UY218_.jpg", "is_prime": false, "rating": 4.7, "ratings_total": 24634, "sponsored": false, "prices": [ { "symbol": "$", "value": 15.93, "currency": "USD", "raw": "$15.93", "name": "Personal Computers" } ], "price": { "symbol": "$", "value": 15.93, "currency": "USD", "raw": "$15.93", "name": "Personal Computers" } }, { "position": 3, "title": "Samsung Evo Plus Class 10 UHS-I microSDXC U3 with Adapter (128GB MB-MC128GA/APC)", "asin": "B07BS3HLY9", "link": "https://www.amazon.com/dp/B07BS3HLY9", "categories": [ { "name": "MemoryWhiz" } ], "image": "https://m.media-amazon.com/images/I/61rxMS7Z2VL._AC_UY218_.jpg", "is_prime": false, "rating": 4.8, "ratings_total": 1651, "sponsored": false, "prices": [ { "symbol": "$", "value": 22.71, "currency": "USD", "raw": "$22.71", "name": "Personal Computers" } ], "price": { "symbol": "$", "value": 22.71, "currency": "USD", "raw": "$22.71", "name": "Personal Computers" } }, { "position": 4, "title": "Lexar Professional 1667X 128GB SDXC Uhs-II/U3 Card (LSD128CBNA1667)", "asin": "B07NLY7N7L", "link": "https://www.amazon.com/dp/B07NLY7N7L", "categories": [ { "name": "MemoryWhiz" } ], "image": "https://m.media-amazon.com/images/I/618JS8-mUjL._AC_UY218_.jpg", "is_prime": false, "rating": 4.6, "ratings_total": 2093, "sponsored": false, "prices": [ { "symbol": "$", "value": 34.21, "currency": "USD", "raw": "$34.21", "name": "primary" }, { "symbol": "$", "value": 44.99, "currency": "USD", "raw": "$44.99" ``` -------------------------------- ### Request Also Bought Details via HTTP Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/also-bought Use this endpoint to retrieve 'also_bought' product recommendations. Specify the product using ASIN and Amazon domain, or a product URL. ```HTTP https://api.rainforestapi.com/request?api_key=demo&type=also_bought&asin=B084ZF5D65&amazon_domain=amazon.com ``` -------------------------------- ### List All Destinations Source: https://docs.trajectdata.com/rainforestapi/destinations-api/list Make an HTTP GET request to the /destinations endpoint to retrieve a list of all destinations. Include your API key for authentication. This example shows how to fetch page 1 of the destinations. ```HTTP https://api.rainforestapi.com/destinations?api_key=demo ``` ```curl $ curl "https://api.rainforestapi.com/destinations?api_key=demo" ``` ```nodejs const axios = require('axios'); axios.get('https://api.rainforestapi.com/destinations?api_key=demo') .then(response => { const apiResponse = response.data; console.log("Total Destinations: ", apiResponse.usage.used); apiResponse.destinations.map((destination, number) => console.log((number + 1) + '. ' + destination.name); }).catch(error => { console.error(error); }); ``` ```python import requests import json params = { 'api_key': 'demo' } api_result = requests.get('https://api.rainforestapi.com/destinations', { params }) api_response = api_result.json() for number, destination in enumerate(api_response['destinations'], start=1): print "%s. %s" % (number, destination['name']) ``` ```php 'demo', ]); $ch = curl_init(sprintf('%s?%s', 'https://api.rainforestapi.com/destinations', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); # the following options are required if you're using an outdated OpenSSL version # more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 180); $json = curl_exec($ch); curl_close($ch); $api_result = json_decode($json, true); print_r($api_result); echo "Total Destinations: ", $api_result['usage']['used'], PHP_EOL; foreach ($api_result['destinations'] as $number => $destination) { echo "{$number}. {$destination['name']}", PHP_EOL; } ?> ``` -------------------------------- ### List Error Logs with Node.js Source: https://docs.trajectdata.com/rainforestapi/errorlogs-api/list Use the axios library to make a GET request to the Error Logs API. This example demonstrates how to fetch and log the total count and IDs of error logs. ```javascript const axios = require('axios'); const params = { api_key: 'demo' } axios.get('https://api.rainforestapi.com/errorlogs?api_key=demo') .then(response => { const apiResponse = response.data; console.log("Total Error Logs: ", apiResponse.results_count_total); apiResponse.logs.map((log, number) => console.log((number + 1) + '. ' + log.id); }).catch(error => { console.error(error); }); ``` -------------------------------- ### HTTP Request for Product Data Source: https://docs.trajectdata.com/rainforestapi/product-data-api/overview Use this URL to directly request product information via HTTP. Ensure you replace 'demo' with your actual API key. ```HTTP https://api.rainforestapi.com/request?api_key=demo&type=product&asin=B000YDDF6O&amazon_domain=amazon.com ``` -------------------------------- ### Request Seller Profile Details Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/seller-profile Examples of how to construct a request to retrieve seller profile data using various programming languages and tools. ```HTTP https://api.rainforestapi.com/request?api_key=demo&type=seller_profile&seller_id=A02211013Q5HP3OMSZC7W&amazon_domain=amazon.com ``` ```curl curl -L --get https://api.rainforestapi.com/request \ -d api_key="demo" \ -d type="seller_profile" \ -d seller_id="A02211013Q5HP3OMSZC7W" \ -d amazon_domain="amazon.com" ``` ```nodejs const axios = require('axios'); // set up the request parameters const params = { api_key: "demo", type: "seller_profile", seller_id: "A02211013Q5HP3OMSZC7W", amazon_domain: "amazon.com" } // make the http GET request to Rainforest API axios.get('https://api.rainforestapi.com/request', { params }) .then(response => { // print the JSON response from Rainforest API console.log(JSON.stringify(response.data, 0, 2)); }).catch(error => { // catch and print the error console.log(error); }) ``` ```python import requests import json # set up the request parameters params = { 'api_key': 'demo', 'type': 'seller_profile', 'seller_id': 'A02211013Q5HP3OMSZC7W', 'amazon_domain': 'amazon.com' } # make the http GET request to Rainforest API api_result = requests.get('https://api.rainforestapi.com/request', params) # print the JSON response from Rainforest API print(json.dumps(api_result.json())) ``` ```php 'demo', 'type' => 'seller_profile', 'asin' => 'A02211013Q5HP3OMSZC7W', 'amazon_domain' => 'amazon.com' ]); # make the http GET request to Rainforest API $ch = curl_init(sprintf('%s?%s', 'https://api.rainforestapi.com/request', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); # the following options are required if you're using an outdated OpenSSL version # more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 180); $api_result = curl_exec($ch); curl_close($ch); # print the JSON response from Rainforest API echo $api_result; ?> ``` -------------------------------- ### PHP Request for Amazon Search Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/search Execute an Amazon product search using PHP with cURL. This example shows how to build the query string and make the GET request, handling potential SSL verification issues. ```php 'demo', 'type' => 'search', 'amazon_domain' => 'amazon.com', 'search_term' => 'memory cards', 'sort_by' => 'price_high_to_low' ]); # make the http GET request to Rainforest API $ch = curl_init(sprintf('%s?%s', 'https://api.rainforestapi.com/request', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); # the following options are required if you're using an outdated OpenSSL version # more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 180); $api_result = curl_exec($ch); curl_close($ch); # print the JSON response from Rainforest API echo $api_result; ?> ``` -------------------------------- ### Request Author Page Data via PHP Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/author-page This PHP example shows how to make a GET request for author page data using cURL. It handles SSL verification options for older OpenSSL versions. ```php 'demo', 'type' => 'author_page', 'amazon_domain' => 'amazon.com', 'asin' => 'B000APVZ7W' ]); # make the http GET request to Rainforest API $ch = curl_init(sprintf('%s?%s', 'https://api.rainforestapi.com/request', $queryString)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); # the following options are required if you're using an outdated OpenSSL version # more details: https://www.openssl.org/blog/blog/2021/09/13/LetsEncryptRootCertExpire/ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 180); $api_result = curl_exec($ch); curl_close($ch); # print the JSON response from Rainforest API echo $api_result; ?> ``` -------------------------------- ### Request Prime-Eligible Offers for a New Product Source: https://docs.trajectdata.com/rainforestapi/product-data-api/parameters/offers Use this example to request Prime-eligible offers for products in new condition. It specifies the Amazon domain and ASIN for the product. ```HTTP https://api.rainforestapi.com/request?api_key=demo&type=offers&amazon_domain=amazon.com&asin=B073JYC4XM&offers_prime=true&offers_condition_new=true ``` -------------------------------- ### Get JSON Download Link for Collection Requests (Node.js) Source: https://docs.trajectdata.com/rainforestapi/collections-api/requests/list This Node.js example uses axios to fetch a JSON download link for all requests within a collection. Provide the correct API key and collection ID. ```javascript const axios = require('axios'); const params = { api_key: 'demo' } axios.get('https://api.rainforestapi.com/collections/123456/requests/json', { params }) .then(response => { const apiResponse = response.data; }).catch(error => { console.log(error); }); ```