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 inventoryItems { inventoryItems(first: 2) { edges { node { id tracked sku } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItems {\n inventoryItems(first: 2) {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 2) {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 2) {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItems {\n inventoryItems(first: 2) {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n}"
input: null
response: { "data": { "inventoryItems": { "edges": [ { "node": { "id": "gid://shopify/InventoryItem/30322695", "tracked": true, "sku": "element-151" } }, { "node": { "id": "gid://shopify/InventoryItem/43729076", "tracked": true, "sku": "draft-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 inventoryItems { inventoryItems(first: 1, query: \\\"sku:'\\''element-151'\\''\\\") { edges { node { id tracked sku } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItems {\n inventoryItems(first: 1, query: \"sku:'element-151'\") {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 1, query: \"sku:'element-151'\") {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 1, query: \"sku:'element-151'\") {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItems {\n inventoryItems(first: 1, query: \"sku:'element-151'\") {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n}"
input: null
response: { "data": { "inventoryItems": { "edges": [ { "node": { "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 inventoryItems { inventoryItems(first: 2, query: \\\"(created_at:>2023-10-10) OR (sku:'\\''element-151'\\'')\\\") { edges { node { id tracked sku } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItems {\n inventoryItems(first: 2, query: \"(created_at:>2023-10-10) OR (sku:'element-151')\") {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 2, query: \"(created_at:>2023-10-10) OR (sku:'element-151')\") {\n edges {\n node {\n id\n tracked\n sku\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 = <<2023-10-10) OR (sku:'element-151')\") {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query inventoryItems {\n inventoryItems(first: 2, query: \"(created_at:>2023-10-10) OR (sku:'element-151')\") {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItems {\n inventoryItems(first: 2, query: \"(created_at:>2023-10-10) OR (sku:'element-151')\") {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n}"
input: null
response: { "data": { "inventoryItems": { "edges": [ { "node": { "id": "gid://shopify/InventoryItem/30322695", "tracked": true, "sku": "element-151" } }, { "node": { "id": "gid://shopify/InventoryItem/43729076", "tracked": true, "sku": "draft-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 InventoryItemList { inventoryItems(first: 20, query: \\\"id:>=30322695\\\") { nodes { id createdAt countryCodeOfOrigin harmonizedSystemCode provinceCodeOfOrigin requiresShipping sku tracked unitCost { currencyCode amount } updatedAt countryHarmonizedSystemCodes(first: 250) { nodes { harmonizedSystemCode countryCode } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query InventoryItemList {\n inventoryItems(first: 20, query: \"id:>=30322695\") {\n nodes {\n id\n createdAt\n countryCodeOfOrigin\n harmonizedSystemCode\n provinceCodeOfOrigin\n requiresShipping\n sku\n tracked\n unitCost {\n currencyCode\n amount\n }\n updatedAt\n countryHarmonizedSystemCodes(first: 250) {\n nodes {\n harmonizedSystemCode\n countryCode\n }\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 InventoryItemList {\n inventoryItems(first: 20, query: \"id:>=30322695\") {\n nodes {\n id\n createdAt\n countryCodeOfOrigin\n harmonizedSystemCode\n provinceCodeOfOrigin\n requiresShipping\n sku\n tracked\n unitCost {\n currencyCode\n amount\n }\n updatedAt\n countryHarmonizedSystemCodes(first: 250) {\n nodes {\n harmonizedSystemCode\n countryCode\n }\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 = <<=30322695\") {\n nodes {\n id\n createdAt\n countryCodeOfOrigin\n harmonizedSystemCode\n provinceCodeOfOrigin\n requiresShipping\n sku\n tracked\n unitCost {\n currencyCode\n amount\n }\n updatedAt\n countryHarmonizedSystemCodes(first: 250) {\n nodes {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query InventoryItemList {\n inventoryItems(first: 20, query: \"id:>=30322695\") {\n nodes {\n id\n createdAt\n countryCodeOfOrigin\n harmonizedSystemCode\n provinceCodeOfOrigin\n requiresShipping\n sku\n tracked\n unitCost {\n currencyCode\n amount\n }\n updatedAt\n countryHarmonizedSystemCodes(first: 250) {\n nodes {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query InventoryItemList {\n inventoryItems(first: 20, query: \"id:>=30322695\") {\n nodes {\n id\n createdAt\n countryCodeOfOrigin\n harmonizedSystemCode\n provinceCodeOfOrigin\n requiresShipping\n sku\n tracked\n unitCost {\n currencyCode\n amount\n }\n updatedAt\n countryHarmonizedSystemCodes(first: 250) {\n nodes {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n}"
input: null
response: { "data": { "inventoryItems": { "nodes": [ { "id": "gid://shopify/InventoryItem/30322695", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "DE", "harmonizedSystemCode": "123456", "provinceCodeOfOrigin": "QC", "requiresShipping": true, "sku": "element-151", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "1.23" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [ { "harmonizedSystemCode": "123456999333", "countryCode": "CA" } ] } }, { "id": "gid://shopify/InventoryItem/43729076", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "draft-151", "tracked": true, "unitCost": null, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/113711323", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "CA", "harmonizedSystemCode": "555555", "provinceCodeOfOrigin": "", "requiresShipping": true, "sku": "element-155", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "15.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/138327650", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "boots-10", "tracked": true, "unitCost": null, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/236948360", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "FR", "harmonizedSystemCode": "654321", "provinceCodeOfOrigin": "", "requiresShipping": true, "sku": "element-158", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/330284860", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "unpublished_boots-12", "tracked": true, "unitCost": null, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/389013007", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "CA", "harmonizedSystemCode": "123456", "provinceCodeOfOrigin": "ON", "requiresShipping": true, "sku": "crappy_shoes_red", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/419425742", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "DE", "harmonizedSystemCode": "999999", "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "crappy_shoes_pink", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/438458761", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "IPOD2008RED", "tracked": true, "unitCost": null, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/445365074", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "IT", "harmonizedSystemCode": "654321", "provinceCodeOfOrigin": "", "requiresShipping": true, "sku": "crappy_shoes_green", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/498744621", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "seo-boots-10", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "15.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/715806386", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "FR", "harmonizedSystemCode": "555555", "provinceCodeOfOrigin": "", "requiresShipping": true, "sku": "crappy_shoes_blue", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } } ] } } }