Return more than 50 items
If you have over 50 items, you can get them all by repeatedly requesting them. You do this by using the same endpoint with limit=50
and the nextCursor
value you get back from each response.
This example has sample code in both cURL and Python.
Step 1: First call (cURL)
Use limit=50
to get the first batch.
Sample request
curl -X GET "https://marketplace.walmartapis.com/v3/inventories?limit=50" \ -H "Authorization: Basic <Base64EncodedConsumerKey:ConsumerSecret>" \ -H "WM_SVC.NAME: Walmart Marketplace" \ -H "WM_QOS.CORRELATION_ID: 0123456789" \ -H "Accept: application/json" \ -H "Content-Type: application/json"
Sample response
{ "meta": { "totalCount": 123, "nextCursor": "0123abcd4567efgh8901" }, "elements": { "inventories": [ { "sku": "SKU0001", "nodes": [ { "shipNode": "NODE0001", "inputQty": { "unit": "EACH", "amount": 100 }, "availToSellQty": { "unit": "EACH", "amount": 95 }, "reservedQty": { "unit": "EACH", "amount": 5 } } ] } // Up to 50 items ] }
}
Step 2 (cURL)
Check the response for nextCursor
. The response returns the nextCursor
string to indicate the next page to start after 50 items.
Step 3: Next call (cURL)
Add the nextCursor
value from the previous response to the same endpoint and call the endpoint again.
Sample request
curl -X GET "https://marketplace.walmartapis.com/v3/inventories?limit=50&nextCursor=0123abcd4567efgh8901" \ -H "Authorization: Basic <Base64EncodedConsumerKey:ConsumerSecret>" \ -H "WM_SVC.NAME: Walmart Marketplace" \ -H "WM_QOS.CORRELATION_ID: 0123456789" \ -H "Accept: application/json" \ -H "Content-Type: application/json"
Sample response
{ "meta": { "totalCount": 100, "nextCursor": null }, "elements": { "inventories": [ { "sku": "SKU0003", "nodes": [ { "shipNode": "NODE0003", "inputQty": { "unit": "EACH", "amount": 75 }, "availToSellQty": { "unit": "EACH", "amount": 70 }, "reservedQty": { "unit": "EACH", "amount": 5 } } ] } // Additional SKU inventory objects as applicable... ] }
}
Steps 1 through 3 (Python)
Complete steps 1 through 3 using a single complete Python script.
import requests url = "https://marketplace.walmartapis.com/v3/inventories"
params = { "limit": 50
} headers = { "Authorization": "Basic <Base64EncodedConsumerKey:ConsumerSecret>", "WM_SVC.NAME": "Walmart Marketplace", "WM_QOS.CORRELATION_ID": "0123456789", "Accept": "application/json", "Content-Type": "application/json"
} all_inventories = []
response = requests.get(url, headers=headers, params=params)
data = response.json() if "elements" in data and "inventories" in data["elements"]: all_inventories.extend(data["elements"]["inventories"]) next_cursor = data.get("meta", {}).get("nextCursor") while next_cursor: params["nextCursor"] = next_cursor response = requests.get(url, headers=headers, params=params) data = response.json() if "elements" in data and "inventories" in data["elements"]: all_inventories.extend(data["elements"]["inventories"]) next_cursor = data.get("meta", {}).get("nextCursor") print("Total items retrieved:", len(all_inventories))
Result
If successful, the API response returns an HTTP status: 200 OK
with a JSON response containing all SKUs for all ship nodes.
Next step
Update the inventory for items in bulk.
Updated 11 days ago