GraphQL - query for date range

jhenzel
New Member
3 0 0

I am trying to run the following graphql query.  I am using the admin api at https://xxxxxxxxx.myshopify.com/admin/api/2021-01/graphql.json

query QueryOrdersForDetails {
  orders(first:250 reverse:true, query:"processed_at:>=2021-03-19T21:00:00Z") {
    edges {
      node {
        processedAt
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
    }
  }
}

The query runs but does not come back with the correct results.  What am I missing?

{
    "data": {
        "orders": {
            "edges": [
                {
                    "node": {
                        "processedAt": "2021-03-19T21:39:58Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T21:20:47Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T21:10:40Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T20:51:49Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T20:46:51Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T20:37:40Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T20:03:11Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T19:49:08Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T19:45:42Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T19:32:14Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T19:30:13Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T19:28:55Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T19:28:27Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T19:19:48Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T19:01:17Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T18:42:13Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T18:02:49Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T17:21:24Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T17:05:18Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T16:51:51Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T16:44:45Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T16:22:44Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T16:18:51Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T15:47:12Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T15:42:42Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T15:41:41Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T15:38:54Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T15:36:34Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T15:08:39Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T14:54:34Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T14:38:08Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T14:31:18Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-19T13:46:57Z"
                    }
                }
            ],
            "pageInfo": {
                "hasNextPage": false,
                "hasPreviousPage": false
            }
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 252,
            "actualQueryCost": 35,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 965,
                "restoreRate": 50.0
            }
        }
    }
}

 

Thanks

0 Likes
Kevin_A
Shopify Staff
Shopify Staff
315 42 54

Hey @jhenzel 

Can you still reproduce this behaviour? If so, can you provide us with the x-request-id response header? I wasn't able to reproduce on my end and would be interested in reviewing some logs of the event. 

Kevin_A | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
jhenzel
New Member
3 0 0

Hi Kevin.

Thanks for looking into this.  When I ran the original query it seemed to produce proper results.  I did another test using

query QueryOrdersForDetails {
  orders(first:250 reverse:true, query:"processed_at:>=2021-03-25T15:00:00Z") {
    edges {
      node {
        processedAt
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
    }
  }
}

 the noted query and I expected to get 4 results back.  My resultset was the following:

 

{
    "data": {
        "orders": {
            "edges": [
                {
                    "node": {
                        "processedAt": "2021-03-25T15:55:09Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-25T15:33:27Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-25T15:23:48Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-25T15:19:59Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-25T14:41:36Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-25T14:02:35Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-25T13:59:42Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-25T13:31:28Z"
                    }
                },
                {
                    "node": {
                        "processedAt": "2021-03-25T07:26:04Z"
                    }
                }
            ],
            "pageInfo": {
                "hasNextPage": false,
                "hasPreviousPage": false
            }
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 252,
            "actualQueryCost": 11,
            "throttleStatus": {
                "maximumAvailable": 1000.0,
                "currentlyAvailable": 989,
                "restoreRate": 50.0
            }
        }
    }
}

 

The X-Request_id was 354b488f-e6e3-450b-9f0d-43f125fb0988  I got the ssame result using the web-based Shopify Graphql editor and using Postman also

 

thanks

 

0 Likes
Kevin_A
Shopify Staff
Shopify Staff
315 42 54

Hey @jhenzel 

Are you still able to reproduce this issue? If so are you able to provide an updated x-request-id for us to look into?

Kevin_A | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes