Version: 2024-10
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query inventoryItem { inventoryItem(id: \\\"gid://shopify/InventoryItem/30322695\\\") { id tracked sku } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n}"
input: null
response: { "data": { "inventoryItem": { "id": "gid://shopify/InventoryItem/30322695", "tracked": true, "sku": "element-151" } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query inventoryItemToProductVariant { inventoryItem(id: \\\"gid://shopify/InventoryItem/30322695\\\") { id inventoryLevels(first: 1) { edges { node { id location { id name } quantities(names: [\\\"available\\\", \\\"committed\\\", \\\"incoming\\\", \\\"on_hand\\\", \\\"reserved\\\"]) { name quantity } } } } variant { id title product { id title } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n}"
input: null
response: { "data": { "inventoryItem": { "id": "gid://shopify/InventoryItem/30322695", "inventoryLevels": { "edges": [ { "node": { "id": "gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695", "location": { "id": "gid://shopify/Location/346779380", "name": "Ottawa Store" }, "quantities": [ { "name": "available", "quantity": 2 }, { "name": "committed", "quantity": 1 }, { "name": "incoming", "quantity": 0 }, { "name": "on_hand", "quantity": 33 }, { "name": "reserved", "quantity": 30 } ] } } ] }, "variant": { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm", "product": { "id": "gid://shopify/Product/20995642", "title": "Element" } } } } }