- 15 Aug 2024
- 4 Minutes to read
- Print
- DarkLight
- PDF
Amazon Selling Partner - Shipments
- Updated on 15 Aug 2024
- 4 Minutes to read
- Print
- DarkLight
- PDF
Amazon Selling Partner - FBA Shipments API
Authorization and Authentication
For a walkthrough on what steps are required before starting the configuration of the Amazon Selling Partner - FBA Shipments 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
. - $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
). - $data_key - The Data Key represents the location of the data in the API response from the Amazon Selling Partner API.
- $primary_key - Primary keys are used to ensure the uniqueness of the rows in a table. The Primary Key is comprised of one or more columns that can be used to identify the row in the data warehouse. The process guarantees that no two rows have the same value in their primary key. For values of this parameter, see the table below in API Resources.
- $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 | $reference | $data_key | $primary_key |
---|---|---|---|
FBA Inbound Shipments | shipments | payload.ShipmentData | {shipmentid} |
FBA Inbound Shipment Items | shipmentItems | payload.ItemData | {shipmentid}-{sellersku} |
Connector configuration
- Base url: $endpoint /fba/inbound/v0/ $reference
- Method: GET
- URL Parameters: MarketplaceIds={marketplace_ids}&QueryType=DATE_RANGE
In addition to the MarketplaceIds
and QueryType
URL Parameters, the FBA Shipments resources allow for further filtering of results with more parameters: Shipments and Shipment Items. 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 Shipments 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_
combined with an aggregation of the Resource (e.g. when collecting the FBA Inbound Shipments resource, using the Destination of amazon_fba_inbound_shipments
)
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
- URL parameters to remove: QueryType
- URL parameters to add: QueryType=NEXT_TOKEN
- Stop iterating when: Empty data
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
- Data key: $data_key
- Errors waiting time: 429=60
- Primary Key: $primary_key
- 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