error: inventory_item_id Required parameter missing or invalid. from inventory_levels/adjust.json

Solved
iAmNotARobot456
Tourist
3 0 1

When calling inventory_levels/adjust.json, I keep getting inventory_item_id Required parameter missing or invalid.  Here is my request below from Fiddler.  Obviously xxx was substituted for the actual data.  FYI, I can pull products, orders, locations, etc., but I have not been able to do any POST operations successfully yet.

POST https://xxxxxxxxxxxxxx.myshopify.com/admin/api/2021-01/inventory_levels/adjust.json HTTP/1.1
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
Accept: application/json, text/json, text/x-json, text/javascript, application/xml, text/xml
User-Agent: RestSharp/106.0.0.0
Content-Type: text/json
Host: xxxxxxxxxxxxx.myshopify.com
Content-Length: 94
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

{

"location_id":59254440111,

"inventory_item_id":40082801983663,

"available_adjustment":928.0000

}

0 Likes
iAmNotARobot456
Tourist
3 0 1

Guys, any input on this?  My request looks identical to what is shown in the documentation.  I'm not sure what could be wrong.

0 Likes
policenauts
Pathfinder
108 6 19

This is an accepted solution.

Can you try to change the content-type to application/json and then stringify the body before sending?

0 Likes
iAmNotARobot456
Tourist
3 0 1

Changing the content type from text/json to application/json fixed the issue.  Thank you so much for your help!  

Here is a Suggestion to the Shopify Dev Team.  It would be helpful if you return an error message such as "Content type not supported text/json.  Supported content types are: application/json....".

Let me also note that once I changed my content type, the API returned a very specific, and helpful error message about available_adjustment being a float instead of an integer.  Notice that in my request I am passing 928.0000, which is not allowed.  I was easily able to change this into an integer, and the API accepted my request just fine.

 

Thanks again for your help.  This API is really easy to use.  This is the only problem I ran into.