FROM CACHE - en_header

Graphql inventoryBulkAdjustQuantityAtLocation mutation from Postman

Solved
LeonardoMolina4
New Member
2 0 2

Hello!! 

We are trying to use the mutation From Postman

POST:

https://${v_api_key}:${v_api_password}@${v_store_name}.myshopify.com/admin/api/2021-04/graphql.json

Body:

mutation{
  inventoryBulkAdjustQuantityAtLocation(
    inventoryItemAdjustments: [{inventoryItemId: "41906055119006",availableDelta: 7}],
    locationId: "62368645278"
){
inventoryLevels {
   id
   }
   userErrors {
     field
     message
  }
}
}

 

Response: 200 ok

{
    "errors": [
        {
            "message""Invalid global id '41906055119006'",
            "locations": [
                {
                    "line"5,
                    "column"35
                }
            ],
            "path": [
                "mutation",
                "inventoryBulkAdjustQuantityAtLocation",
                "inventoryItemAdjustments",
                0,
                "inventoryItemId"
            ],
            "extensions": {
                "code""argumentLiteralsIncompatible",
                "typeName""CoercionError"
            }
        },
        {
            "message""Invalid global id '62368645278'",
            "locations": [
                {
                    "line"3,
                    "column"5
                }
            ],
            "path": [
                "mutation",
                "inventoryBulkAdjustQuantityAtLocation",
                "locationId"
            ],
            "extensions": {
                "code""argumentLiteralsIncompatible",
                "typeName""CoercionError"
            }
        }
    ]
}
 
LeonardoMolina4_1-1620849769377.png

 

Can you help us with that error?

 

Accepted Solution (1)

Accepted Solutions
Kevin_A
Shopify Staff
Shopify Staff
318 42 60

This is an accepted solution.

Hey @LeonardoMolina4 

First off, please make sure you delete that image from the post and immediately rotate those API keys as they are clearly visible in the screenshot you posted. In regards to your error, GraphQL uses global IDs so they would need to look something like: 

gid://shopify/InventoryItem/123456789

 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 2 (2)
Kevin_A
Shopify Staff
Shopify Staff
318 42 60

This is an accepted solution.

Hey @LeonardoMolina4 

First off, please make sure you delete that image from the post and immediately rotate those API keys as they are clearly visible in the screenshot you posted. In regards to your error, GraphQL uses global IDs so they would need to look something like: 

gid://shopify/InventoryItem/123456789

 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

amer2737
Tourist
3 0 0

I use the same example but I have these error
where is the problem?

amer2737_0-1645543387140.png