POST call /inventory_levels/set.json returns oauth link

Solved
BartJR
New Member
2 1 0

Hi everyone,

 

I want to create a new application to update inventory levels manually. In order to do this I looked at https://shopify.dev/docs/admin-api/rest/reference/inventory/inventorylevel.

  • I created a private application and set permission for "Inventory" to read and write.
  • In Postman I created a new GET request, with Authorization Type "Basic Auth" and entered the key and password. In this case a get request on /admin/api/2021-04/inventory_levels.json?inventory_item_ids=42172356526249 
  • GET request got me this outcome (all good):

 

{
    "inventory_levels": [
        {
            "inventory_item_id": 42172356526249,
            "location_id": 61798908073,
            "available": 0,
            "updated_at": "2021-04-19T21:27:49+02:00",
            "admin_graphql_api_id": "gid://shopify/InventoryLevel/96112017577?inventory_item_id=42172356526249"
        }
    ]
}

 

  • Then I created a POST call using the same basic authorization with username and password to /admin/api/2021-04/inventory_levels/set.json in using a raw JSON body containing this:
{
"location_id": 61798908073,
"inventory_item_id": 42172356526249,
"available": 42
}
This returns HTTP 200, but instead of getting the correct JSON with the updated inventory, I get an oauth link however, that says "Continue".

I'm sure I'm doing something wrong here, but I can't figure it out. What am I missing here?

0 Likes
BartJR
New Member
2 1 0

This is an accepted solution.

Took a while, but figured it out. Removing the cookies did the trick!

0 Likes