To update inventory quantity of multiple items on Amazon Seller Central

Need to update inventory quantity of multiple items on Amazon Seller Central.

Custom flow is used to do this

Suitescript Hook is used to fetch saved search data from the Netsuite side

It is possible to update the inventory of a single item, but multiple-item updation is not happening.

Details provided are:

API TYPE = selling partner API

HTTP method = POST

relative URI = /feeds/2021-06-30/documents

Override request media type= XML

Feed type= POST_INVENTORY_AVAILABILITY_DATA

I have provided data in mapping section mapper1.0

HTTP request body (handlebars template)

<?xml version='1.0' encoding='UTF-8'?>
<AmazonEnvelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='amzn-envelope.xsd'>
   
<Header>
  <content-type>application/json></content-type>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>xxxxxxx</MerchantIdentifier>
<FulfillmentCenterID>xxxxxxxxxxxx</FulfillmentCenterID>
</Header>
<MessageType>Inventory</MessageType>
{{#each data}}
<Message>
<MessageID>{{{add @index 1}}}</MessageID>
<OperationType>PartialUpdate</OperationType>
<Inventory>
<SKU>{{SKU}}</SKU>
<FulfillmentCenterID>{{FulfillmentCenterID}}</FulfillmentCenterID>
<Quantity>{{Quantity}}</Quantity>
<Available>{{Available}}</Available>
<Lookup>{{Lookup}}</Lookup>
</Inventory>
</Message>
{{/each}}
</AmazonEnvelope>

 

And the preview to evaluate your handlebars template (according to the HTTP request body)

<MerchantIdentifier>xxxxxxxx</MerchantIdentifier>
<FulfillmentCenterID>xxxxxxxxxxx</FulfillmentCenterID>
</Header>
<MessageType>Inventory</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>PartialUpdate</OperationType>
<Inventory>
<SKU>M5</SKU>
<FulfillmentCenterID>xxxxxxx</FulfillmentCenterID>
<Quantity>108</Quantity>
<Available>True</Available>
<Lookup>FulfillmentNetwork</Lookup>
</Inventory>
</Message>
</AmazonEnvelope>

0

Comments

10 comments
Date Votes
  • Anju Babu that looks right. Is it working when you run the flow and it's maybe only in preview where it's showing 1 item? Here is the setup I've got:

    <?xml version='1.0' encoding='UTF-8'?>
    <AmazonEnvelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='amzn-envelope.xsd'>
        <Header>
            <DocumentVersion>1.01</DocumentVersion>
        </Header>
        <MessageType>Inventory</MessageType>
        {{#each data}}
            <Message>
                <MessageID>{{{add @index 1}}}</MessageID>
                <OperationType>PartialUpdate</OperationType>
                <Inventory>
                    <SKU>{{SKU}}</SKU>
                    <FulfillmentCenterID>{{FulfillmentCenterID}}</FulfillmentCenterID>
                        <Quantity>{{Quantity}}</Quantity>
                        <Available>{{Available}}</Available>
                        <Lookup>{{Lookup}}</Lookup>
                    <RestockDate>{{RestockDate}}</RestockDate>
                    <FulfillmentLatency>{{FulfillmentLatency}}</FulfillmentLatency>
                    <SwitchFulfillmentTo>{{SwitchFulfillmentTo}}</SwitchFulfillmentTo>
                </Inventory>
            </Message>
        {{/each}}
    </AmazonEnvelope>
    0
  • While running the flow it shows a success status of 2 ( In the saved search there are 2 items ).

    But when checking on Amazon's side there is no updation for these 2 items.

    I am also providing the same HTTP request body you have provided.

    The only difference is that in our code we are not giving Restock Date, Fulfillment Latency, and SwitchFulfillmentTo. Other details are given in the above format.

     

    But my updation of a single item was successful, in that flow I fetched data from the saved search in the  NetSuite. During that time there was only 1 item in that search.

    Now I had edited the search and included 2 items in that and made a small change in HTTP request body, because now need to fetch 2 items and I included a loop (#each data). But in this case after running the flow there is no error but no updation is happening.

    0
  • Anju Babu do you have an async helper set to get the results back from Amazon?

    Can you download the feed results directly within Amazon's portal? Does it show 2 items sent? What are the statuses on them?

     

    What page size do you have your export from NetSuite set as? 

    0
  • No, I do not have an async helper.

    We cant download the feed results directly from Amazon Seller Central

    page size is like 1 page ( which includes 3 records)

     The data we received on the Export side is:

    {
      "page_of_records": [
        {
          "record": {
            "id": "7448",
            "recordType": "lotnumberedinventoryitem",
            "Stock Description": "NA305P",
            "Qty available": "197",
            "Name": "OA : NA305P",
            "dataURI": "https://1312745.app.netsuite.com/app/common/item/item.nl?id=7448&compid=1312745"
          }
        },
        {
          "record": {
            "id": "13828",
            "recordType": "lotnumberedinventoryitem",
            "Stock Description": "P5CAMO",
            "Qty available": "13",
            "Name": "OA : P5CAMO",
            "dataURI": "https://1312745.app.netsuite.com/app/common/item/item.nl?id=13828&compid=1312745"
          }
        },
        {
          "record": {
            "id": "7077",
            "recordType": "lotnumberedinventoryitem",
            "Stock Description": "SHSTRAP3",
            "Qty available": "142",
            "Name": "OA : SHSTRAP3",
            "dataURI": "https://1312745.app.netsuite.com/app/common/item/item.nl?id=7077&compid=1312745"
          }
        }
      ]
    }

     

    But when we reach the mapping side the input preview is showing like this 

    {
      "id": "7395",
      "recordType": "lotnumberedinventoryitem",
      "Stock Description": "CU200",
      "Qty available": "109",
      "Name": "CB : CU200",
      "dataURI": "https://1312745.app.netsuite.com/app/common/item/item.nl?id=7395&compid=1312745",
      "stockDescription1": "CU200",
      "quantityAvailable2": null
    } only one data is reaching here 

    And I provided a mapping

    But the output preview is repeating the same item details like

    {
      "MerchantIdentifier": "xxxxxx",
      "FulfillmentCenterID": "xxxxxxxx",
      "data": [
        {
          "SKU": "CU200",
          "Quantity": "109"
        },
        {
          "SKU": "CU200",
          "Quantity": "109"
        },
        {
          "SKU": "CU200",
          "Quantity": "109"
        },
        {
          "SKU": "CU200",
          "Quantity": "109"
        },
        {
          "SKU": "CU200",
          "Quantity": "109"
        },
        {
          "SKU": "CU200",
          "Quantity": "109"
        },
        {
          "SKU": "CU200",
          "Quantity": "109"
        },
        {
          "SKU": "CU200",
          "Quantity": "109"
        }
      ]
    }

     

    What is the reason for this?

    0
  • Anju Babu it looks like you are confusing a record vs a page of records. When using mapper 2.0, your input is a single record. So what you're trying to do by making header values and and a data array don't make sense in this context. I bet if you were to go into the POST XML body, you would see something like {data[{data[]}]} because you're creating an additional nested data array for a single record. I would recommend you just remove the mapper settings and go directly to the POST XML body and modify your handlebars to reference the correct field names. If you leave mapper 2.0, you can use it to basically just rename the fields there and then use the same xml body you already have.

    0
  • Without providing Mapper 2.0 I have run the flow. But still, the updation on Amazon Seller Central is not happening.

    Here we provided an HTTP request body only, in that we are taking the data from the NetSuite through item search directly.

    While taking the preview of this HTTP request body output, the value is getting correctly as shown as

    <MerchantIdentifier>xxxxxxxx</MerchantIdentifier>
    <FulfillmentCenterID>xxxxxxxxxxx</FulfillmentCenterID>
    </Header>
    <MessageType>Inventory</MessageType>
    <Message>
    <MessageID>1</MessageID>
    <OperationType>Update</OperationType>
    <Inventory>
    <SKU>M5</SKU>
    <Quantity>108</Quantity>
    </Inventory>
    </Message>
    </AmazonEnvelope>

    0
  • Anju Babu you may want to attend office hours next week. Something must be setup wrong and it's tough to keep going back and forth here. Here is the link to sign up https://docs.celigo.com/hc/en-us/articles/360045798291

    0
  • Anju Babu Hope you have attended office hours and your issue has been resolved. It would be great if you could share the resolution for your issue as it may be helpful for others who may face similar issues.

    0
  • Any updates or otherwise new news on this?  I seem to be experiencing the same exact issue as original poster.  This handlebar template works in updating Amazon when just a single ITEM is in the result of the saved search.

    But when more than one ITEM is in the NetSuite saved search result, I receive the below error:

    An invalid JSON is sent in the request.body, error: please ensure that you have wrapped all JSON property names in quotes. details: Unexpected token < in JSON at position 0

     

     

    0
  • Brian Brown can you join office hours next week? I don't think Anju ever joined so there was no resolution here. That being said, we have thousands of customers using this so it's just some configuration issue.

    https://docs.celigo.com/hc/en-us/articles/360045798291

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post