POST inventory_levels/set 404 response

kjryan
Visitor
2 0 3

Hoping you can help me with the following issue I’m seeing when helping suppliers connect to the Shopify API (specifically for Inventory and Fulfillment). Here is the Inventory example:

POST /admin/api/2020-10/inventory_levels/set.json

Request Body (location_id is incorrect)

{

"location_id": 37119626,

"inventory_item_id": 1606348996620,

"available": 42

}

Response Code: 404

Response Content:

{

"errors": "Not Found"

}

 

POST /admin/api/2020-10/inventory_levels/set.json

Request Body (location_id is missing)

{

"inventory_item_id": 1606348996620,

"available": 42

}

Response Code: 400

Response Content:

{

"errors": {

"location_id": "Required parameter missing or invalid"

}

}

Regardless of the response code, it would be helpful to get the detail in the response content to let us know which field specifically could not be found. This will help us better serve our customers, many of whom do not always know the ids specific to Shopify. Appreciate your help!

Replies 2 (2)

parkerjm
Tourist
16 0 3

only time I've ever seen this is when I used the wrong `location_id`. the `inventory_item_id` will be different at each location, so make sure you are using the right combination.

edit: oh I see your question is more about how to tell what's wrong. yeah, it's pretty hard to tell. all you know is that the combination of `location_id` and `inventory_item_id` is invalid. maybe this is by design.

JohnHoltRipley
Shopify Partner
4 1 3

Yeah, this caught me out, I assumed that inventory_item_id was the product id, and it's not.

 

From https://shopify.dev/api/admin-rest/2023-01/resources/inventoryitem
"There is a 1:1 relationship between a product variant and an inventory item. Each product variant includes the ID of its related inventory item."