Re: Attempting to set inventory level returns 404 response

Attempting to set inventory level returns 404 response

khaoscontrol
Shopify Partner
7 0 0

We have a client who is currently having issues with updating the inventory level on their store with it always returning a 404 error response.

We are able to make a GET call to the inventory levels successfully using the inventory item ID, and then we update the response from this with the new Available level to then send back up using the set.json POST call.

We have other clients using this same workflow and everything works as expected, it is only for this client that we're having problems.

We have confirmed that the required permissions are correct.

One thing I did notice is that we're making the calls to one URL but when looking at the request the was sent in the response information, it's using another URL, so it looks like redirects are in place (the same occurs in the GET calls which are successful).

Could a redirect have an impact and cause POST calls to fail?

Replies 3 (3)

Conner
Shopify Partner
54 2 14

@khaoscontrol,

I know this post is fairly old at this point, but I figured I'd comment since I ran into the same thing.

Using the Location URL provided in the redirect's response headers will indeed allow the POST to go through. I just ended up swapping the URLs out and everything is working OK now.

FaizaBashir
Shopify Partner
39 0 3

could you please explain ho you resolved this issue? I am having same issue

Conner
Shopify Partner
54 2 14

@FaizaBashir In your request that is getting the 404 error, check the response headers. If this is the same issue I was experiencing, the Location URL will be different than the URL you're making the request to. If you instead make the request to the Location URL, it will go through OK.

i.e.
This request fails:
POST foo.shopify.com/dosomething
Response Code: 404
Response LocationURL: bar.shopify.com/dosomething

This works:
POST bar.shopify.com/dosomething
Response Code: 200