Problem with /inventory_levels/adjust.json

Highlighted
New Member
4 0 0

Hello dear community, I have tried all the APIs and they have worked well for me, but as much as I try and do everything, I cannot update the inventory level of a product variant. Specifically I am using this api:

 

https://{shop}.myshopify.com/admin/api/2019-10/inventory_levels/adjust.json

 

With this Json body:
{
"location_id": 34499100758,
"inventory_item_id": 31906732736598,
"available_adjustment": 1
}

This should give a response in Json format, however answer is an html text:

<html>
<body>
<noscript>
<a href="https://app.shopify.com/services/login/identity?destination_uuid=21528af2-b564-4c8c-8c4a-26fd558d4f3a&amp;merge_ignore_postponed=false&amp;prompt=merge&amp;return_to=https%3A%2F%2Fapp.shopify.com%2Fservices%2Flogin%2Fidentity_callback%3Fshop_name%3DPetcol%2BDemo%26state%3DVstlO4JYRrQbQXGNWKCgXaAXmGxHEswmV3i9Iii2tPxV7CIt8wQjFEyQ2Q_dArUoB4Z8Q_k_cOjFmC4pa7DvHEvIFDcZAHGRMdfKaKBRjL_X-ml8YQ0jd_yWGHx25wJmDic98P_vYLq8PYarlnsIJNZSUuZAUfNABGbd07V2_FSCVfXGQA-2GCik7gZ6h7v8cIRlY0DMYbL2pF7dEAW_Ji1YTKSrxVcK0FIPtzI4xlE%253D&amp;ui_locales=en&amp;ux=shop">Continue</a>
</noscript>

<script type="text/javascript">
window.location = "https:\/\/app.shopify.com\/services\/login\/identity?destination_uuid=21528af2-b564-4c8c-8c4a-26fd558d4f3a\u0026merge_ignore_postponed=false\u0026prompt=merge\u0026return_to=https%3A%2F%2Fapp.shopify.com%2Fservices%2Flogin%2Fidentity_callback%3Fshop_name%3DPetcol%2BDemo%26state%3DVstlO4JYRrQbQXGNWKCgXaAXmGxHEswmV3i9Iii2tPxV7CIt8wQjFEyQ2Q_dArUoB4Z8Q_k_cOjFmC4pa7DvHEvIFDcZAHGRMdfKaKBRjL_X-ml8YQ0jd_yWGHx25wJmDic98P_vYLq8PYarlnsIJNZSUuZAUfNABGbd07V2_FSCVfXGQA-2GCik7gZ6h7v8cIRlY0DMYbL2pF7dEAW_Ji1YTKSrxVcK0FIPtzI4xlE%253D\u0026ui_locales=en\u0026ux=shop";
</script>
</body>
</html>

And finally it does NOT update the inventory level of the variant. I am lost, most likely I am doing something wrong, but I am doing things as is indicated in the inventory update API manual. I would appreciate any help, any light at the end of the road.

 

Note: this response in HTML format appears in a REST client, in another client simply nothing appears in the Json response.

0 Likes
Community Manager
Community Manager
618 45 81

 

Hi @GrupoDatasoft,

 

Can you make sure you're doing the following:

 

- Not including any cookies in the request. Clients like Postman can sneak cookies in the request which will cause HTML responses

- Include an Accept header with the value of application/json

- Include a Content Type header with the value of application/json

 

Let me know if you continue having trouble after that.

 

Cheers,

0 Likes
New Member
4 0 0

 Hello, thanks for answering, what you tell me I had already done, under no conditions I send cookies, I also always send the necessary headers, I still cannot solve this problem, it is assumed that this API should work correctly as the other APIs work, since I am having problems with my clients for not being able to give them a clear solution to update their inventories!

0 Likes

Hi 

 

Did you try to use Postman? If so, problems can be with cookies

The issue is caused by Shopify refusing to allow POSTs to fulfill with Basic Authentication when the POST contains cookies.

Decrease fraudulent orders, stop chargebacks and expand globally with Beacon. https://apps.shopify.com/beacon
0 Likes
New Member
4 0 0

Hello, thanks for answering, NO, I don't use postman, I work with Delphi and its TRestClient component, and I already know that I don't send cookies, in fact I never send cookies

0 Likes

I used to work with Delphi, but not with TRestClient...
So i don't even know what suggest to you.

But probably here in Community someone has worked on that before, with TRestClient.

Decrease fraudulent orders, stop chargebacks and expand globally with Beacon. https://apps.shopify.com/beacon
0 Likes
New Member
4 0 0

Thanks you so much!


@Alex_Beacon wrote:

I used to work with Delphi, but not with TRestClient...
So i don't even know what suggest to you.

But probably here in Community someone has worked on that before, with TRestClient.


 

0 Likes