Version: 2024-04
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { draftOrders(first: 10) { edges { node { id } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n draftOrders(first: 10) {\n edges {\n node {\n id\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 {\n draftOrders(first: 10) {\n edges {\n node {\n id\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 {\n draftOrders(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n draftOrders(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n}"
input: null
response: { "data": { "draftOrders": { "edges": [ { "node": { "id": "gid://shopify/DraftOrder/12873508" } }, { "node": { "id": "gid://shopify/DraftOrder/14492994" } }, { "node": { "id": "gid://shopify/DraftOrder/15964851" } }, { "node": { "id": "gid://shopify/DraftOrder/17011624" } }, { "node": { "id": "gid://shopify/DraftOrder/33942910" } }, { "node": { "id": "gid://shopify/DraftOrder/35687358" } }, { "node": { "id": "gid://shopify/DraftOrder/35831665" } }, { "node": { "id": "gid://shopify/DraftOrder/57615313" } }, { "node": { "id": "gid://shopify/DraftOrder/116136825" } }, { "node": { "id": "gid://shopify/DraftOrder/138565067" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { draftOrders(first: 10, query: \\\"created_at:>2019-12-01\\\") { edges { node { id createdAt } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n draftOrders(first: 10, query: \"created_at:>2019-12-01\") {\n edges {\n node {\n id\n createdAt\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 {\n draftOrders(first: 10, query: \"created_at:>2019-12-01\") {\n edges {\n node {\n id\n createdAt\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 = <<2019-12-01\") {\n edges {\n node {\n id\n createdAt\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 {\n draftOrders(first: 10, query: \"created_at:>2019-12-01\") {\n edges {\n node {\n id\n createdAt\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n draftOrders(first: 10, query: \"created_at:>2019-12-01\") {\n edges {\n node {\n id\n createdAt\n }\n }\n }\n}"
input: null
response: { "data": { "draftOrders": { "edges": [ { "node": { "id": "gid://shopify/DraftOrder/12873508", "createdAt": "2021-12-01T12:42:15Z" } }, { "node": { "id": "gid://shopify/DraftOrder/14492994", "createdAt": "2021-12-01T12:42:15Z" } }, { "node": { "id": "gid://shopify/DraftOrder/15964851", "createdAt": "2021-12-01T12:42:15Z" } }, { "node": { "id": "gid://shopify/DraftOrder/17011624", "createdAt": "2021-12-01T12:42:15Z" } }, { "node": { "id": "gid://shopify/DraftOrder/33942910", "createdAt": "2021-12-01T12:42:15Z" } }, { "node": { "id": "gid://shopify/DraftOrder/35687358", "createdAt": "2021-12-01T12:42:15Z" } }, { "node": { "id": "gid://shopify/DraftOrder/35831665", "createdAt": "2021-12-01T12:42:15Z" } }, { "node": { "id": "gid://shopify/DraftOrder/57615313", "createdAt": "2021-12-01T12:42:15Z" } }, { "node": { "id": "gid://shopify/DraftOrder/116136825", "createdAt": "2021-12-01T12:42:15Z" } }, { "node": { "id": "gid://shopify/DraftOrder/138565067", "createdAt": "2021-12-01T12:42:15Z" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { draftOrders(first: 10, query: \\\"status:OPEN\\\") { edges { node { id status } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n draftOrders(first: 10, query: \"status:OPEN\") {\n edges {\n node {\n id\n status\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 {\n draftOrders(first: 10, query: \"status:OPEN\") {\n edges {\n node {\n id\n status\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 {\n draftOrders(first: 10, query: \"status:OPEN\") {\n edges {\n node {\n id\n status\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n draftOrders(first: 10, query: \"status:OPEN\") {\n edges {\n node {\n id\n status\n }\n }\n }\n}"
input: null
response: { "data": { "draftOrders": { "edges": [ { "node": { "id": "gid://shopify/DraftOrder/12873508", "status": "OPEN" } }, { "node": { "id": "gid://shopify/DraftOrder/14492994", "status": "OPEN" } }, { "node": { "id": "gid://shopify/DraftOrder/15964851", "status": "OPEN" } }, { "node": { "id": "gid://shopify/DraftOrder/17011624", "status": "OPEN" } }, { "node": { "id": "gid://shopify/DraftOrder/33942910", "status": "OPEN" } }, { "node": { "id": "gid://shopify/DraftOrder/35687358", "status": "OPEN" } }, { "node": { "id": "gid://shopify/DraftOrder/35831665", "status": "OPEN" } }, { "node": { "id": "gid://shopify/DraftOrder/57615313", "status": "OPEN" } }, { "node": { "id": "gid://shopify/DraftOrder/116136825", "status": "OPEN" } }, { "node": { "id": "gid://shopify/DraftOrder/138565067", "status": "OPEN" } } ] } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { draftOrders(first: 1, query: \\\"customerId:544365967\\\") { edges { node { id status customer { firstName } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n draftOrders(first: 1, query: \"customerId:544365967\") {\n edges {\n node {\n id\n status\n customer {\n firstName\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 {\n draftOrders(first: 1, query: \"customerId:544365967\") {\n edges {\n node {\n id\n status\n customer {\n firstName\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 = <<query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n draftOrders(first: 1, query: \"customerId:544365967\") {\n edges {\n node {\n id\n status\n customer {\n firstName\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n draftOrders(first: 1, query: \"customerId:544365967\") {\n edges {\n node {\n id\n status\n customer {\n firstName\n }\n }\n }\n }\n}"
input: null
response: { "data": { "draftOrders": { "edges": [ { "node": { "id": "gid://shopify/DraftOrder/12873508", "status": "OPEN", "customer": { "firstName": "Bob" } } } ] } }, "extensions": { "search": [ { "path": [ "draftOrders" ], "query": "customerId:544365967", "parsed": { "field": "customerId", "match_all": "544365967" }, "warnings": [ { "field": "customerId", "message": "Invalid search field for this query." } ] } ] } }