- 15 Aug 2024
- 6 Minutes to read
- Print
- DarkLight
- PDF
Amazon Selling Partner - Orders
- Updated on 15 Aug 2024
- 6 Minutes to read
- Print
- DarkLight
- PDF
Amazon Selling Partner - Orders API
Authorization and Authentication
For a walkthrough on what steps are required before starting the configuration of the Amazon Selling Partner - Orders API Flex Connector, please see the Before You Start section of the Amazon Selling Partner home page.
Any instance where an entry in the below configuration has a leading $ represents a parameter that needs to be replaced with a static value.
Parameters in this document:
- $client_id, $client_secret and $refresh_token - The Client ID, Client Secret, and Refresh Token will be used to authenticate calls to the Amazon Selling Partner API. These values are all obtained as part of the Authorization and Authentication steps of developing your Amazon application for API access. These three parameters should be available to you in the Developer Console upon completion of the steps outlined in the Before You Start section of the Amazon Selling Partner home page.
- $endpoint - The Endpoint represents the data that you would like to ingest into Panoply from the Amazon Selling Partner API. This is the portion of the Base URL associated with the AWS Region. Visit here for the list of regions and their associated endpoint. As an example, for
us-east-1
, this parameter will behttps://sellingpartnerapi-na.amazon.com
. - $resource_name - The Resource Name represents the name of the resource to be appended and used as part of the Destination Table name. The value that should be used here can be found in the API Resources table below.
- $reference - The Reference is the portion of the Base URL that represents the data that is being ingested into Panoply. The value of this parameter can be found in the API Resources section below.
- $marketplace_ids - The Marketplace IDs represent the market(s) for which data is being pulled from the API. For a list of valid Marketplace ID's, visit here. Note that this can be a list of multiple Marketplace IDs, or just a single value, depending on the use case. When entering multiple values, they should be entered as a comma separated list (e.g.
A2EUQ1WTGCTBG2,ATVPDKIKX0DER
). - $incremental_starting_value - The Incremental Starting Value represents the starting date of incremental collections, given in
yyyy-mm-DD
format. After completing the historical data load outlined in the URL Parameters section of each configuration below, this value should be set to the last date that was collected in the historical collections.
API Resources
Resource | $resource_name | $reference |
---|---|---|
Orders | orders | |
Order Buyer Info | order_buyer_info | orders/v0/orders/{identifier}/buyerInfo |
Order Address | order_address | orders/v0/orders/{identifier}/address |
Order Fulfillment Instructions | order_fulfillment_instructions | orders/v0/orders/{identifier}/fulfillmentInstructions |
Order Regulated Info | order_regulated_info | orders/v0/orders/{identifier}/regulatedInfo |
Order Items | order_items | orders/v0/orders/{identifier}/orderItems |
Order Items Buyer Info | order_items_buyer_info | orders/v0/orders/{identifier}/orderItems/buyerInfo |
NOTE: The first configuration section below is for the Orders resource only, while the second configuration section is for the other 6 resources.
Orders Resource Only
Connector configuration
- Base url: $endpoint /orders/v0/orders
- Method: GET
- URL Parameters: MarketplaceIds={marketplace_ids}
In addition to the MarketplaceIds
URL Parameter, the Orders resource allows for further filtering of results with more parameters found here. We recommend at least using the LastUpdatedAfter
and LastUpdatedBefore
parameters, with the following format being used:
- When initially collecting historical data, set the
LastUpdatedAfter
andLastUpdatedBefore
parameters to capture back to the start of data you'd like to ingest, and work 1 month at a time until you've collected up to the current date. Please note that if you have a large number of Orders in your Amazon Selling Partner account, you may need to work in smaller increments in order to most efficiently collect data and avoid any failures. If there are any questions on which strategy would be best for you given your case, please reach out to our Support Team and we would be happy to assist.
Data availability from Amazon will go back 2 years from the current date. As an example to this collection strategy:- Run 1:
LastUpdatedAfter=2023-01-01&LastUpdatedBefore=2023-02-01
- Run 2:
LastUpdatedAfter=2023-02-01&LastUpdatedBefore=2023-03-01
- Run 3:
LastUpdatedAfter=2023-03-01&LastUpdatedBefore=2023-04-01
- Run 1:
- Upon completion of the backfill of data, you can remove the
LastUpdatedBefore
value and instead only set theLastUpdatedAfter
to the following value, which will allow for incremental collections of data moving forward and thus keeping data up-to-date without ingesting more than we need to:LastUpdatedAfter=<<date_format(date_add({incval}, 'days', -1), '%Y-%m-%d')>>
Destination table naming convention is ultimately up to you as the data owner. One common structure used for this API is amazon_sp_$resource_name (e.g. when collecting the Orders resource, using the Destination of amazon_sp_orders
)
Variables
- Variables
Variable name | Variable value |
---|---|
marketplace_ids | $marketplace_ids |
- Secured Variables:
Variable name | Variable value |
---|---|
client_id | $client_id |
client_secret | $client_secret |
refresh_token | $refresh_token |
Pagination
- Enable:
- Get next page value: Dynamic (next page value included in the response)
- Next page key in response: payload.NextToken
- Use next page value: As a URL parameter value
- URL/body key: NextToken
- Stop iterating when: No next page in response
Refresh access token
- Enable:
- URL: https://api.amazon.com/auth/o2/token
- Method: POST
- POST data: {"grant_type":"refresh_token", "client_id":"{client_id}", "client_secret":"{client_secret}"}
- Headers: {"Content-Type":"application/x-www-form-urlencoded"}
- Refresh token: {refresh_token}
- Access token response key: access_token
- Access Token header key: x-amz-access-token
- Error status codes: 401; 403
Advanced Settings
- Disable configuration validation:
- Data key: payload.Orders
- Errors waiting time: 429=60
- Primary Key: {amazonorderid}
- Incremental Key:
Column name Column value lastTimeSucceed $incremental_starting_value
When entering a column value to the incremental key feature, you will need to use the following format: YYYY-MM-DD
6 Additional Resources
Connector configuration
- Base url: $endpoint / $reference
- Method: GET
Destination table naming convention is ultimately up to you as the data owner. One common structure used for this API is amazon_sp_$resource_name (e.g. when collecting the Orders resource, using the Destination of amazon_sp_orders
)
Variables
- Variables
Variable name | Variable value |
---|---|
marketplace_ids | $marketplace_ids |
- Secured Variables:
Variable name | Variable value |
---|---|
client_id | $client_id |
client_secret | $client_secret |
refresh_token | $refresh_token |
Pagination
- Enable:
- Get next page value: Dynamic (next page value included in the response)
- Next page key in response: payload.NextToken
- Use next page value: As a URL parameter value
- URL/body key: NextToken
- Stop iterating when: No next page in response
Refresh access token
- Enable:
- URL: https://api.amazon.com/auth/o2/token
- Method: POST
- POST data: {"grant_type":"refresh_token", "client_id":"{client_id}", "client_secret":"{client_secret}"}
- Headers: {"Content-Type":"application/x-www-form-urlencoded"}
- Refresh token: {refresh_token}
- Access token response key: access_token
- Access Token header key: x-amz-access-token
- Error status codes: 401; 403
Fetch list
- Enable:
- Fetch List From: API
- Fetch url: https://sellingpartnerapi-na.amazon.com/orders/v0/orders
- Method: GET
- URL Parameters: MarketplaceIds={marketplace_ids}
In addition to the MarketplaceIds
URL Parameter, the Orders resource allows for further filtering of results with more parameters found here. We recommend at least using the LastUpdatedAfter
and LastUpdatedBefore
parameters, with the following format being used:
- When initially collecting data, set the
LastUpdatedAfter
andLastUpdatedBefore
parameters to capture back to the start of data you'd like to ingest, and work 1 month at a time until you've collected up to the current date. Please note that if you have a large number of Orders in your Amazon Selling Partner account, you may need to work in smaller increments in order to most efficiently collect data and avoid any failures. If there are any questions on which strategy would be best for you given your case, please reach out to our Support Team and we would be happy to assist.
Data availability from Amazon will go back 2 years from the current date. As an example to this collection strategy:- Run 1:
LastUpdatedAfter=2023-01-01&LastUpdatedBefore=2023-02-01
- Run 2:
LastUpdatedAfter=2023-02-01&LastUpdatedBefore=2023-03-01
- Run 3:
LastUpdatedAfter=2023-03-01&LastUpdatedBefore=2023-04-01
- Run 1:
- Upon completion of the backfill of data, you can remove the
LastUpdatedBefore
value and instead only set theLastUpdatedAfter
to the following value, which will allow for incremental collections of data moving forward and thus keeping data up-to-date without ingesting more than we need to:LastUpdatedAfter=<<date_format(date_add({incval}, 'days', -1), '%Y-%m-%d')>>
- Data key: payload.Orders
- Data identifier key: AmazonOrderId
- Errors waiting time: 429=120
- Enable Pagination:
- Get next page value: Dynamic (next page value included in the response)
- Next page key in response: payload.NextToken
- Use next page value: As a URL parameter value
- URL/body key: NextToken
- Stop iterating when: No next page in response
- Use identifiers: As single value
Advanced Settings
- Disable configuration validation:
- Data key: payload
- Errors waiting time: 429=60
- Primary Key: {amazonorderid}
- Incremental Key:
Column name Column value lastTimeSucceed $incremental_starting_value
When entering a column value to the incremental key feature, you will need to use the following format: yyyy-mm-DD