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 { event(id: \\\"gid://shopify/BasicEvent/422690323\\\") { id message ... on BasicEvent { action subjectType subject { __typename } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n event(id: \"gid://shopify/BasicEvent/422690323\") {\n id\n message\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\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 event(id: \"gid://shopify/BasicEvent/422690323\") {\n id\n message\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\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 event(id: \"gid://shopify/BasicEvent/422690323\") {\n id\n message\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\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 event(id: \"gid://shopify/BasicEvent/422690323\") {\n id\n message\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n event(id: \"gid://shopify/BasicEvent/422690323\") {\n id\n message\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\n }\n }\n }\n}"
input: null
response: { "data": { "event": { "id": "gid://shopify/BasicEvent/422690323", "message": "bob bobsen included a product on Online Store: <a href=\"https://admin.myshopify.io/store/snowdevil/admin/products/440089423\">IPod Nano - 8GB</a>.", "action": "published", "subjectType": "PRODUCT", "subject": { "__typename": "Product" } } } }
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 EventShow($id: ID!) { event(id: $id) { id action createdAt message ... on BasicEvent { arguments subjectId subjectType additionalContent } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/BasicEvent/267851118\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query EventShow($id: ID!) {\n event(id: $id) {\n id\n action\n createdAt\n message\n ... on BasicEvent {\n arguments\n subjectId\n subjectType\n additionalContent\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/BasicEvent/267851118\"\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 EventShow($id: ID!) {\n event(id: $id) {\n id\n action\n createdAt\n message\n ... on BasicEvent {\n arguments\n subjectId\n subjectType\n additionalContent\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/BasicEvent/267851118\"\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 = <<<QUERY\n query EventShow($id: ID!) {\n event(id: $id) {\n id\n action\n createdAt\n message\n ... on BasicEvent {\n arguments\n subjectId\n subjectType\n additionalContent\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/BasicEvent/267851118\",\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 EventShow($id: ID!) {\n event(id: $id) {\n id\n action\n createdAt\n message\n ... on BasicEvent {\n arguments\n subjectId\n subjectType\n additionalContent\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/BasicEvent/267851118\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query EventShow($id: ID!) {\n event(id: $id) {\n id\n action\n createdAt\n message\n ... on BasicEvent {\n arguments\n subjectId\n subjectType\n additionalContent\n }\n }\n}"
input: { "id": "gid://shopify/BasicEvent/267851118" }
response: { "data": { "event": { "id": "gid://shopify/BasicEvent/267851118", "action": "unpublished", "createdAt": "2006-06-09T12:00:00Z", "message": "", "arguments": [], "subjectId": "gid://shopify/Product/630255015", "subjectType": "PRODUCT", "additionalContent": "null" } } }