Version: 2025-01
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { locations(first: 5) { edges { node { id name address { formatted } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n locations(first: 5) {\n edges {\n node {\n id\n name\n address {\n formatted\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 locations(first: 5) {\n edges {\n node {\n id\n name\n address {\n formatted\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\n query {\n locations(first: 5) {\n edges {\n node {\n id\n name\n address {\n formatted\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 {\n locations(first: 5) {\n edges {\n node {\n id\n name\n address {\n formatted\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n locations(first: 5) {\n edges {\n node {\n id\n name\n address {\n formatted\n }\n }\n }\n }\n}"
input: null
response: { "data": { "locations": { "edges": [ { "node": { "id": "gid://shopify/Location/346779380", "name": "Ottawa Store", "address": { "formatted": [ "126 york street", "second and third floor", "ottawa ON k1n5t5", "Canada" ] } } }, { "node": { "id": "gid://shopify/Location/648019273", "name": "Ottawa Store geo located", "address": { "formatted": [ "126 york street", "second and third floor", "ottawa ON k1n5t5", "Canada" ] } } }, { "node": { "id": "gid://shopify/Location/884687543", "name": "Ottawa Warehouse", "address": { "formatted": [ "Canada" ] } } }, { "node": { "id": "gid://shopify/Location/124656943", "name": "Shipping Origin", "address": { "formatted": [ "190 MacLaren Street", "Ottawa ON K2P 0L6", "Canada" ] } } }, { "node": { "id": "gid://shopify/Location/750123840", "name": "Toronto Store", "address": { "formatted": [ "620 King St. W", "toronto ON m5v1m5", "Canada" ] } } } ] } } }