Adjust Inventory Levels API doesn't work.

Highlighted
Tourist
9 0 1

Hi,

I did several requests follow what is instructed from this link.

After got the location_id (which in this case is 39816790155), I attempted to request on 

'https://{shop}.myshopify.com//api/2020-01/inventory_levels/adjust.json'
with the POST method and body like this: 
const adjustmentBody = JSON.stringify({
                  location_id:39816790155,
                  inventory_item_id: variant.inventory_item_id,
                  available_adjustment: variant.stock, 
                })

then the response show the error:

{ url:
      'https://{shop}.myshopify.com//api/2020-01/inventory_levels/adjust.json',
     status: 415,
     statusText: 'Unsupported Media Type',
     headers: Headers { [Symbol(map)]: [Object] },
     counter: 0 } }

Please point out what I did wrong and why did I receive such that 415 status while I was just trying to update the inventory of my products?

 

Thanks.

0 Likes
Highlighted
Tourist
9 0 1

Hi friend,

 

Sorry about this post as I figured out that I mistyped 'admin' in my request URL. 
Please skip this stupid thread. 


@hoangfuongduy wrote:

Hi,

I did several requests follow what is instructed from this link.

After got the location_id (which in this case is 39816790155), I attempted to request on 

'https://{shop}.myshopify.com//api/2020-01/inventory_levels/adjust.json'
with the POST method and body like this: 
const adjustmentBody = JSON.stringify({
                  location_id:39816790155,
                  inventory_item_id: variant.inventory_item_id,
                  available_adjustment: variant.stock, 
                })

then the response show the error:

{ url:
      'https://{shop}.myshopify.com//api/2020-01/inventory_levels/adjust.json',
     status: 415,
     statusText: 'Unsupported Media Type',
     headers: Headers { [Symbol(map)]: [Object] },
     counter: 0 } }

Please point out what I did wrong and why did I receive such that 415 status while I was just trying to update the inventory of my products?

 

Thanks.


 

0 Likes