What’s strange is I was responding to another post regarding searching for orders by tags. While the REST API was giving the OP some issues, I pointed them to the GraphQL API. The strange part is I provided a test example. Searching for an order that had the tag test_tag defined. There was a single record passed back. But when I searched for just test for the tag query no results came up. Doesn’t this contradict what is discussed above? Or perhaps it has to do with the matched tag not having a space in it?
Here are the API request/response pairs below. Just curious…
POST https://{my_shop}.myshopify.com/admin/api/2020-04/graphql.json HTTP/1.1
X-Shopify-Access-Token: {my_token}
Content-Type: application/graphql
User-Agent: PostmanRuntime/7.26.2
Accept: */*
Postman-Token: 6e2f9e4e-b250-4ef2-a598-f598b75cc5be
Host: {my_shop}.myshopify.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 159
Cookie: __cfduid=d63090a1de3eaa36b02875cfabcf0fc221595426473
query {
orders(first: 10, query:"tag:test") {
edges {
cursor
node {
id
name
tags
}
}
}
}
HTTP/1.1 200 OK
Date: Fri, 31 Jul 2020 13:09:14 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
X-Sorting-Hat-PodId: 161
X-Sorting-Hat-ShopId: 3036253
Vary: Accept-Encoding
Referrer-Policy: origin-when-cross-origin
X-Frame-Options: DENY
X-ShopId: 3036253
X-ShardId: 161
X-Stats-UserId:
X-Stats-ApiClientId: 309925
X-Stats-ApiPermissionId: 8304915
X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms
X-Shopify-API-Version: 2020-04
Content-Language: en
Strict-Transport-Security: max-age=7889238
X-Request-Id: d1ae6d3c-adf8-44a3-9c5f-9eed85baf6fb
X-Shopify-Stage: production
Content-Security-Policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://checkout.us.shopifycs.com https://js-agent.newrelic.com https://bam.nr-data.net https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=query&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fgraphql&source%5Bsection%5D=admin_api&source%5Buuid%5D=d1ae6d3c-adf8-44a3-9c5f-9eed85baf6fb
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=query&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fgraphql&source%5Bsection%5D=admin_api&source%5Buuid%5D=d1ae6d3c-adf8-44a3-9c5f-9eed85baf6fb
X-Dc: gcp-us-central1,gcp-us-central1
NEL: {"report_to":"network-errors","max_age":2592000,"failure_fraction":0.01,"success_fraction":0.0001}
Report-To: {"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifycloud.com/v1/reports/nel/20190325/shopify"}]}
CF-Cache-Status: DYNAMIC
cf-request-id: 044696c2a6000083c9880fa200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5bb78d7ddd0683c9-ORD
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
Content-Length: 189
{"data":{"orders":{"edges":[]}},"extensions":{"cost":{"requestedQueryCost":12,"actualQueryCost":2,"throttleStatus":{"maximumAvailable":1000.0,"currentlyAvailable":998,"restoreRate":50.0}}}}
------------------------------------------------------------------
POST https://{my_shop}.myshopify.com/admin/api/2020-04/graphql.json HTTP/1.1
X-Shopify-Access-Token: {my_token}
Content-Type: application/graphql
User-Agent: PostmanRuntime/7.26.2
Accept: */*
Postman-Token: 16575bd1-5765-43fd-a31a-7d66c682751e
Host: {my_shop}.myshopify.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 163
Cookie: __cfduid=d63090a1de3eaa36b02875cfabcf0fc221595426473
query {
orders(first: 10, query:"tag:test_tag") {
edges {
cursor
node {
id
name
tags
}
}
}
}
HTTP/1.1 200 OK
Date: Fri, 31 Jul 2020 13:09:24 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
X-Sorting-Hat-PodId: 161
X-Sorting-Hat-ShopId: 3036253
Vary: Accept-Encoding
Referrer-Policy: origin-when-cross-origin
X-Frame-Options: DENY
X-ShopId: 3036253
X-ShardId: 161
X-Stats-UserId:
X-Stats-ApiClientId: 309925
X-Stats-ApiPermissionId: 8304915
X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms
X-Shopify-API-Version: 2020-04
Content-Language: en
Strict-Transport-Security: max-age=7889238
X-Request-Id: 23e9d339-1e16-48f9-9822-389b0abb98a3
X-Shopify-Stage: production
Content-Security-Policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://cdn.shopifycdn.net https://checkout.us.shopifycs.com https://js-agent.newrelic.com https://bam.nr-data.net https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=query&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fgraphql&source%5Bsection%5D=admin_api&source%5Buuid%5D=23e9d339-1e16-48f9-9822-389b0abb98a3
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=query&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fgraphql&source%5Bsection%5D=admin_api&source%5Buuid%5D=23e9d339-1e16-48f9-9822-389b0abb98a3
X-Dc: gcp-us-central1,gcp-us-central1
NEL: {"report_to":"network-errors","max_age":2592000,"failure_fraction":0.01,"success_fraction":0.0001}
Report-To: {"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifycloud.com/v1/reports/nel/20190325/shopify"}]}
CF-Cache-Status: DYNAMIC
cf-request-id: 044696e9c5000003a63306a200000001
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 5bb78dbc6ee003a6-ORD
alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400
Content-Length: 363
{"data":{"orders":{"edges":[{"cursor":"eyJsYXN0X2lkIjoyNTY3NDQwMjM2NzA2LCJsYXN0X3ZhbHVlIjoxNTk0MjI4NjI4MDAwfQ==","node":{"id":"gid:\/\/shopify\/Order\/2567440236706","name":"#1316","tags":["test_tag"]}}]}},"extensions":{"cost":{"requestedQueryCost":12,"actualQueryCost":3,"throttleStatus":{"maximumAvailable":1000.0,"currentlyAvailable":997,"restoreRate":50.0}}}}
------------------------------------------------------------------