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 DiscountRedeemCodeBulkShow($id: ID!) { discountRedeemCodeBulkCreation(id: $id) { id createdAt discountCode { id } done codesCount importedCount failedCount } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DiscountRedeemCodeBulkCreation/989355202\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query DiscountRedeemCodeBulkShow($id: ID!) {\n discountRedeemCodeBulkCreation(id: $id) {\n id\n createdAt\n discountCode {\n id\n }\n done\n codesCount\n importedCount\n failedCount\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DiscountRedeemCodeBulkCreation/989355202\"\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 DiscountRedeemCodeBulkShow($id: ID!) {\n discountRedeemCodeBulkCreation(id: $id) {\n id\n createdAt\n discountCode {\n id\n }\n done\n codesCount\n importedCount\n failedCount\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DiscountRedeemCodeBulkCreation/989355202\"\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 = <<\"gid://shopify/DiscountRedeemCodeBulkCreation/989355202\",\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 DiscountRedeemCodeBulkShow($id: ID!) {\n discountRedeemCodeBulkCreation(id: $id) {\n id\n createdAt\n discountCode {\n id\n }\n done\n codesCount\n importedCount\n failedCount\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DiscountRedeemCodeBulkCreation/989355202\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query DiscountRedeemCodeBulkShow($id: ID!) {\n discountRedeemCodeBulkCreation(id: $id) {\n id\n createdAt\n discountCode {\n id\n }\n done\n codesCount\n importedCount\n failedCount\n }\n}"
input: { "id": "gid://shopify/DiscountRedeemCodeBulkCreation/989355202" }
response: { "data": { "discountRedeemCodeBulkCreation": { "id": "gid://shopify/DiscountRedeemCodeBulkCreation/989355202", "createdAt": "2024-11-06T21:07:10Z", "discountCode": { "id": "gid://shopify/DiscountCodeNode/2429471" }, "done": true, "codesCount": 2, "importedCount": 2, "failedCount": 1 } } }
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 DiscountRedeemCodeBulkShow($id: ID!) { discountRedeemCodeBulkCreation(id: $id) { id createdAt discountCode { id } codes(first: 10) { nodes { discountRedeemCode { code } errors { message field extraInfo code } } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/DiscountRedeemCodeBulkCreation/989355205\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query DiscountRedeemCodeBulkShow($id: ID!) {\n discountRedeemCodeBulkCreation(id: $id) {\n id\n createdAt\n discountCode {\n id\n }\n codes(first: 10) {\n nodes {\n discountRedeemCode {\n code\n }\n errors {\n message\n field\n extraInfo\n code\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/DiscountRedeemCodeBulkCreation/989355205\"\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 DiscountRedeemCodeBulkShow($id: ID!) {\n discountRedeemCodeBulkCreation(id: $id) {\n id\n createdAt\n discountCode {\n id\n }\n codes(first: 10) {\n nodes {\n discountRedeemCode {\n code\n }\n errors {\n message\n field\n extraInfo\n code\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/DiscountRedeemCodeBulkCreation/989355205\"\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 = <<\"gid://shopify/DiscountRedeemCodeBulkCreation/989355205\",\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 DiscountRedeemCodeBulkShow($id: ID!) {\n discountRedeemCodeBulkCreation(id: $id) {\n id\n createdAt\n discountCode {\n id\n }\n codes(first: 10) {\n nodes {\n discountRedeemCode {\n code\n }\n errors {\n message\n field\n extraInfo\n code\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/DiscountRedeemCodeBulkCreation/989355205\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query DiscountRedeemCodeBulkShow($id: ID!) {\n discountRedeemCodeBulkCreation(id: $id) {\n id\n createdAt\n discountCode {\n id\n }\n codes(first: 10) {\n nodes {\n discountRedeemCode {\n code\n }\n errors {\n message\n field\n extraInfo\n code\n }\n }\n }\n }\n}"
input: { "id": "gid://shopify/DiscountRedeemCodeBulkCreation/989355205" }
response: { "data": { "discountRedeemCodeBulkCreation": { "id": "gid://shopify/DiscountRedeemCodeBulkCreation/989355205", "createdAt": "2024-11-06T21:07:11Z", "discountCode": { "id": "gid://shopify/DiscountCodeNode/2429471" }, "codes": { "nodes": [ { "discountRedeemCode": { "code": "FOOBAR" }, "errors": [] }, { "discountRedeemCode": { "code": "FOOBAZ" }, "errors": [] }, { "discountRedeemCode": null, "errors": [ { "message": "must be unique. Please try a different code.", "field": [ "code" ], "extraInfo": null, "code": null } ] } ] } } } }