SImple update inventory levels.

Highlighted
Tourist
5 0 2

I really hope someone can help as this has been driving me crazy for weeks.

I am Trying to update inventory levels for items.

using the following url

https://{store}.myshopify.com/admin/api/inventory_levels/set.json

I am sending

{"location_id":484343866,"inventory_item_id":34697005105188,"available":10}

This fails - all I get is status code 406

Please any help would be good, I cannot see where I am going wrong.

I am getting the ID 34697005105188 by using admin/products.json with the product ID

1 Like
Highlighted
Shopify Partner
45 8 31

Hello @Allspoke1 

Tested this few times. Looks like IDs and construction is correct otherwise it would return 404 or 400.

From what I can see 406 is returned if using incorrect method. You should be using POST, but you might be calling PUT, could you make sure that correct method is called for this update?

Excelify.io | Bulk Import Export Update with Excel | https://apps.shopify.com/excel-export-import | https://excelify.io
0 Likes
Highlighted
Tourist
5 0 2

Hi Renars

Thanks for your assistance. I checked the code and the call being made is 

loResp = loHttp.PText("POST",lcUrl,loJsonRequestBody.Emit(),"utf-8","application/json",0,0) so it is using POST. I am creating item and downloading orders, just this one (very important) function left.

Any ideas at all?

Mark

0 Likes
Highlighted
Excursionist
17 0 6

You may need to provide the API version in the URL.

According to the docs, the URL should look like this

/admin/api/2020-07/inventory_levels/set.json

with the year and month API version coming after /api and before the resource. 

0 Likes
Highlighted
Shopify Partner
593 41 118

And have you checked the access scope permissions to see that this function is allowed for your API credentials? 

https://shopify.dev/docs/admin-api/access-scopes

Although looking at the URL in your OP I think it's incorrect. As @ellitt pointed out.

0 Likes
Highlighted
New Member
1 0 0

I have the same problem. I'm looking for a solution.

0 Likes