A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
To synchronize the updated products from shopify to our plugin, We are using graphql API to fetch the updated products at regular interval.
For the following request, it is expected to return products for which updated_at field greater than 15:39 GMT.
{
"query": "{ products(first:10, query:\"updated_at:>2021-10-05T15:39:01Z\") { edges { node { id title updatedAt } } } }"
}
But in the API response we are seeing products which has updated_at before 15:39, Here is the screenshot:
This looks like the issue from API, How can i get the resolution for this?
Solved! Go to the solution
This is an accepted solution.
Hey @Ananthesh,
After some testing on my end, I found no issues with query arguments using multiple parameters from the list available in GraphQL for Products queries. This worked when using updated_at
and other arguments like created_at
, each returning expected results, including several requests to navigate additional timeframes, as well as using the : >
'greater-than' and other comparators in the query argument string.
I would suggest working through some more testing, reviewing our detailed documentation on API search syntax here and consider using the most recent API version as a starting point moving forward.
- Cheers!
Here is an example of a successful request made in Postman, API Version 2021-10, and the GraphQL body type:
POST {shop}.myshopify.com/admin/api/2021-10/graphql.json
{
products(first: 5, query:"updated_at:>2021-10-13T19:17:05Z"){ // replace updated_at with specific time
edges {
node {
id
updatedAt
title
}
}
}
}
awwdam | API 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
I have noticed one more thing, The products updated at certain time of the hour will be available with filtering of updated_at field upto the next hour.
Here, Product got pulled up with filter greater than 15:59
But these 2 products stopped coming when the filter is greater than 16:00
This is an accepted solution.
Hey @Ananthesh,
After some testing on my end, I found no issues with query arguments using multiple parameters from the list available in GraphQL for Products queries. This worked when using updated_at
and other arguments like created_at
, each returning expected results, including several requests to navigate additional timeframes, as well as using the : >
'greater-than' and other comparators in the query argument string.
I would suggest working through some more testing, reviewing our detailed documentation on API search syntax here and consider using the most recent API version as a starting point moving forward.
- Cheers!
Here is an example of a successful request made in Postman, API Version 2021-10, and the GraphQL body type:
POST {shop}.myshopify.com/admin/api/2021-10/graphql.json
{
products(first: 5, query:"updated_at:>2021-10-13T19:17:05Z"){ // replace updated_at with specific time
edges {
node {
id
updatedAt
title
}
}
}
}
awwdam | API 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
Same problem here with the current graphql Api 2022-01:
{"query":"query {orders(first: 5, query: \"updated_at:>2022-02-01T23:00:00Z\") {edges{node{updatedAt}}}}"}
returns also orders, which was edited today but before 23:00:00 o clock:
(object) array(
data =>
(object) array(
orders =>
(object) array(
edges =>
array (
0 =>
(object) array(
node =>
(object) array(
updatedAt => 2022-02-01T17:55:57Z,
),
),
1 =>
(object) array(
node =>
(object) array(
updatedAt => 2022-02-01T11:38:25Z,
),
),
2 =>
(object) array(
node =>
(object) array(
updatedAt => 2022-02-01T03:55:28Z,
),
),
),
),
),
extensions =>
(object) array(
cost =>
(object) array(
requestedQueryCost => 7,
actualQueryCost => 5,
throttleStatus =>
(object) array(
maximumAvailable => 1000.0,
currentlyAvailable => 995,
restoreRate => 50.0,
),
),
),
)
I can not see what I'm doing wrong.
The docs also does only provide an example with a date not with a date time, so it seems not to be implemented:
Hi, The issue is real. I tried the latest api also. Filter on the date is not working.
The below query is fetching dates that are less than the one specified in the filter
```
{
products(first:5,query:"updatedAt:>2023-10-14") {
edges {
node {
prodId:id
prodTitle:title
productType
vendor
handle
updatedAt
}
}
}
}
```
@awwdam wrote:Hey @Ananthesh,
After some testing on my end, I found no issues with query arguments using multiple parameters from the list available in GraphQL for Products queries. This worked when using updated_at and other arguments like created_at, each returning expected results, including several requests to navigate additional timeframes, as well as using the : > 'greater-than' and other comparators in the query argument string.
I would suggest working through some more testing, reviewing our detailed documentation on API search syntax here and consider using the most recent API version as a starting point moving forward.
- Cheers!
Here is an example of a successful request made in Postman, API Version 2021-10, and the GraphQL body type:
POST {shop}.myshopify.com/admin/api/2021-10/graphql.json
{
products(first: 5, query:"updated_at:>2021-10-13T19:17:05Z"){ // replace updated_at with specific time
edges {
node {
id
updatedAt
title
}
}
}
}
@awwdam wrote:Hey @Ananthesh,
After some testing on my end, I found no issues with query arguments using multiple parameters from the list available in GraphQL for Products queries. This worked when using updated_at and other arguments like created_at, each returning expected results, including several requests to navigate additional timeframes, as well as using the : > 'greater-than' and other comparators in the query argument string.
I would suggest working through some more testing, reviewing our detailed documentation on API search syntax here and consider using the most recent API version as a starting point moving forward.
- Cheers!
Here is an example of a successful request made in Postman, API Version 2021-10, and the GraphQL body type:
POST {shop}.myshopify.com/admin/api/2021-10/graphql.json
{
products(first: 5, query:"updated_at:>2021-10-13T19:17:05Z"){ // replace updated_at with specific time
edges {
node {
id
updatedAt
title
}
}
}
}
Just tried updated_at instead of updatedAt. It worked.
Not sure though but this should be the issue.
Make sure to wrap your date string in single quotes like this:
query:"updated_at:>'2021-10-13T19:17:05Z'"