Marketplaces / Amazon SP API - Technical Scope / Amazon Smart Connect / Amazon Smart Connect - Update Inventory

Amazon Smart Connect - Update Inventory

Version Created by Date Note
1.0 Danail Deltchev 20.09.2024 First Publish

The purpose of this page is to detail how to use the Amazon Smart Connect API to send stock updates from Hemi to Amazon’s own FBA network

As part of the whole Amazon Smart Connect management Amazon treat the seller’s (our customer) warehouse basically as one of their own. What this allows is for an essentially “FBA” product (fulfilled by Amazon) to be actually populated with stock availability by the seller’s own warehouse. This way Amazon track if an order is coming for their fulfilment or for the seller’s warehouse and provide the further Shipment information for the fulfilment of the order.

The inventory update connection is very simple. It can work only SKU by SKU so when our script works it just has to pick everything on pending as per our abstraction standards and fire away. All validations, triggers and standardizations which are not mentioned here are as per: Stock Update general requirements

Amazon related documentation:

Inventory APIs (1).docx

External Fulfillment Inventory API - Sandbox Testing.docx

Request handling

API call: https://sellingpartnerapi-na.amazon.com/externalFulfillment/inventory/2021-01-06/locations/{locationId}/skus/{skuId}?quantity={quantity}

where {locationId}, {skuId} and {quantity} are parameters we need to fill in for each stock update we want to send

Method: PUT

Parameters:

Amazon Parameter Hemi Field Hemi Notes
locationId Account Amazon > Location ID
NEW FIELD This is a simple field we need to pick every time we start sending stock updates. As we currently update quantity only in one marketplace location we don’t need to complicate this with location mappings, etc.

Please add the new field in the SmartConnect tab. | | skuId | Product > SKU | | | quantity | Product Account > Quantity | |

Header - there is one more parameter we need to pass as a header otherwise updates will NOT work and only the first stock update will pass through successfully

Note: Inventory for shows it as not mandatory - it can be seen as mandatory only at the end of the Sandbox doc

Amazon Parameter Hemi Field Hemi Notes
If-Unmodified-Since Time of the call We need to pick the current time of sending an inventory update and format it the right way. The expected formatting is rfc2616, e.g: Sun, 06 Nov 1994 08:49:37 GMT

If I am not mistaking this is ('D, d M Y H:i:s T') formatting

This should be sent with every call |

This functionality should fully follow standard abstraction for stock updates

As part of the Amazon handling we need to make sure it functions in a few specific conditions:

  • Account Amazon > Amazon Central is set to “Smart Connect”
  • Account Amazon > Update Stock is set to “Yes”

Response handling

Success - when successful we expect to receive 200 OK.

Please note there is an option that there is a node with Errors in the body of the success response too. These errors are called “sellerActionableErrors” and if we see this we are to store an error on the product

Example Success response (please note that I’ve added the error part myself to an existing simpler example)


    "sellableQuantity": 15,
    "reservedQuantity": 0,
    "marketplaceChannelInventories": [
        {
            "sellableQuantity": 13,
            "bufferedQuantity": 2,
            "marketplaceAttributes": {
                "marketplaceName": "AMAZON_IN",
                "channelName": "FBA"
            },
            "sellerActionableErrors": [
                {
                    "errorType": "PRODUCT_ATTRIBUTE_VALIDATION_FAILURE",
                    "errorSubtype": "MISSING_WEIGHT",
                    "errorDescription": "Product is missing required attributes",
                    "errorSubtypeDescription": "No product weight entered for SKU"
                }
            ]
        }
    ]
}

From the above “error” example we need to map “errorDescription” and “errorSubtypeDescription” in the format “errorDescription”: “errorSubtypeDescription”. Please note that the “sellerActionabelErrors” is an array so multiple error objects can be in there. If such we’d like to store the mapping for every error in there.

The above error should be read and stored only when it is coming for “channelName” = “FBA” AND has the same “marketplaceName” as the country for this specific Amazon account (to be picked from Amazon Account > Country and mapped to the country code from here: https://developer-docs.amazon.com/sp-api/docs/marketplace-ids). If we receive in the response an error for another Marketplace Name or Channel Name we don’t want to treat this as an error for our current request.

Error - fairly standard error handling, we don’t have to map any specific error to something different. Below an example of an error as per their documentation. All errors follow the same format so we have to map the “code”, “message”, and “details” in the error message we store in Hemi in whatever format deemed readable.

{
    "errors": [
     {
        "code": "",
        "message": "",
        "details": ""
        }
    ]
}
Is this article helpful?
0 0 0