Version: 2024-01
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { shopifyqlQuery(query: \\\"FROM orders SHOW sum(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\\\") { __typename ... on TableResponse { tableData { unformattedData rowData columns { name dataType displayName } } } parseErrors { code message range { start { line character } end { line character } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n shopifyqlQuery(query: \"FROM orders SHOW sum(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\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 shopifyqlQuery(query: \"FROM orders SHOW sum(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\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 shopifyqlQuery(query: \"FROM orders SHOW sum(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\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 shopifyqlQuery(query: \"FROM orders SHOW sum(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n shopifyqlQuery(query: \"FROM orders SHOW sum(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\n }\n }\n }\n }\n}"
input: null
response: { "data": { "shopifyqlQuery": { "__typename": "TableResponse", "tableData": { "unformattedData": [ [ "2022-08-01T00:00:00-04:00", 1274587.26 ], [ "2022-09-01T00:00:00-04:00", 970295.86 ], [ "2022-10-01T00:00:00-04:00", 814255.86 ], [ "2022-11-01T00:00:00-04:00", 876740.54 ] ], "rowData": [ [ "Aug 2022", "$1,274,587.26" ], [ "Sep 2022", "$970,295.86" ], [ "Oct 2022", "$814,255.86" ], [ "Nov 2022", "$876,740.54" ] ], "columns": [ { "name": "month", "dataType": "month", "displayName": "Month" }, { "name": "monthly_net_sales", "dataType": "price", "displayName": "Monthly net sales" } ] }, "parseErrors": null } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { shopifyqlQuery(query: \\\"FROM orders SHOW su(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\\\") { __typename ... on TableResponse { tableData { unformattedData rowData columns { name dataType displayName } } } parseErrors { code message range { start { line character } end { line character } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n shopifyqlQuery(query: \"FROM orders SHOW su(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\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 shopifyqlQuery(query: \"FROM orders SHOW su(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\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 shopifyqlQuery(query: \"FROM orders SHOW su(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\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 shopifyqlQuery(query: \"FROM orders SHOW su(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n shopifyqlQuery(query: \"FROM orders SHOW su(net_sales) AS monthly_net_sales GROUP BY month SINCE -3m ORDER BY month\") {\n __typename\n ... on TableResponse {\n tableData {\n unformattedData\n rowData\n columns {\n name\n dataType\n displayName\n }\n }\n }\n parseErrors {\n code\n message\n range {\n start {\n line\n character\n }\n end {\n line\n character\n }\n }\n }\n }\n}"
input: null
response: { "data": { "shopifyqlQuery": { "__typename": "TableResponse", "tableData": null, "parseErrors": [ { "code": "FUNCTION_MODIFIER_NOT_FOUND", "message": "su' is an invalid function. See documentation for more information on available functions.", "range": { "start": { "line": 0, "character": 17 }, "end": { "line": 0, "character": 19 } } } ] } } }