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 { giftCards(first: 5, query: \\\"status:enabled\\\") { edges { node { id enabled } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n giftCards(first: 5, query: \"status:enabled\") {\n edges {\n node {\n id\n enabled\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 giftCards(first: 5, query: \"status:enabled\") {\n edges {\n node {\n id\n enabled\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 giftCards(first: 5, query: \"status:enabled\") {\n edges {\n node {\n id\n enabled\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n giftCards(first: 5, query: \"status:enabled\") {\n edges {\n node {\n id\n enabled\n }\n }\n }\n}"
input: null
response: { "data": { "giftCards": { "edges": [ { "node": { "id": "gid://shopify/GiftCard/63396415", "enabled": true } }, { "node": { "id": "gid://shopify/GiftCard/292935194", "enabled": true } }, { "node": { "id": "gid://shopify/GiftCard/411106674", "enabled": true } }, { "node": { "id": "gid://shopify/GiftCard/566141102", "enabled": true } }, { "node": { "id": "gid://shopify/GiftCard/636946744", "enabled": true } } ] } } }
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 { giftCards(first: 5, query: \\\"1234\\\") { edges { node { id lastCharacters } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n giftCards(first: 5, query: \"1234\") {\n edges {\n node {\n id\n lastCharacters\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 giftCards(first: 5, query: \"1234\") {\n edges {\n node {\n id\n lastCharacters\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 giftCards(first: 5, query: \"1234\") {\n edges {\n node {\n id\n lastCharacters\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n giftCards(first: 5, query: \"1234\") {\n edges {\n node {\n id\n lastCharacters\n }\n }\n }\n}"
input: null
response: { "data": { "giftCards": { "edges": [ { "node": { "id": "gid://shopify/GiftCard/411106674", "lastCharacters": "1234" } } ] } } }
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 { giftCards(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 giftCards(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 giftCards(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 giftCards(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n giftCards(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n}"
input: null
response: { "data": { "giftCards": { "edges": [ { "node": { "id": "gid://shopify/GiftCard/63396415" } }, { "node": { "id": "gid://shopify/GiftCard/83783397" } }, { "node": { "id": "gid://shopify/GiftCard/292935194" } }, { "node": { "id": "gid://shopify/GiftCard/411106674" } }, { "node": { "id": "gid://shopify/GiftCard/566141102" } }, { "node": { "id": "gid://shopify/GiftCard/636946744" } }, { "node": { "id": "gid://shopify/GiftCard/638517611" } }, { "node": { "id": "gid://shopify/GiftCard/665558842" } }, { "node": { "id": "gid://shopify/GiftCard/746346263" } }, { "node": { "id": "gid://shopify/GiftCard/842921201" } } ] } } }
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 GiftCardList($first: Int, $query: String) { giftCards(first: $first, query: $query) { edges { node { id balance { amount currencyCode } } } } }\",\n \"variables\": {\n \"first\": 5,\n \"query\": \"status:enabled\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query GiftCardList($first: Int, $query: String) {\n giftCards(first: $first, query: $query) {\n edges {\n node {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"first\": 5,\n \"query\": \"status:enabled\"\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 GiftCardList($first: Int, $query: String) {\n giftCards(first: $first, query: $query) {\n edges {\n node {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"first\": 5,\n \"query\": \"status:enabled\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<5,\n \"query\" => \"status:enabled\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query GiftCardList($first: Int, $query: String) {\n giftCards(first: $first, query: $query) {\n edges {\n node {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"first\": 5,\n \"query\": \"status:enabled\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query GiftCardList($first: Int, $query: String) {\n giftCards(first: $first, query: $query) {\n edges {\n node {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n }\n}"
input: { "first": 5, "query": "status:enabled" }
response: { "data": { "giftCards": { "edges": [ { "node": { "id": "gid://shopify/GiftCard/63396415", "balance": { "amount": "10.0", "currencyCode": "USD" } } }, { "node": { "id": "gid://shopify/GiftCard/292935194", "balance": { "amount": "75.0", "currencyCode": "EUR" } } }, { "node": { "id": "gid://shopify/GiftCard/411106674", "balance": { "amount": "25.0", "currencyCode": "USD" } } }, { "node": { "id": "gid://shopify/GiftCard/566141102", "balance": { "amount": "0.23", "currencyCode": "USD" } } }, { "node": { "id": "gid://shopify/GiftCard/636946744", "balance": { "amount": "75.0", "currencyCode": "USD" } } } ] } } }