A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello,
Trying to query cancelled orders only. They should have non-null values:
"cancel_reason" and "cancelled_at" - REST syntax
"cancelReason" and "cancelledAt" - GraphiQL syntax
First query I tried should return all orders after specified date with non-null cancel reason (according to syntax guide "*" should do that):
{
orders(query:"created_at:>'2023-04-02T00:00:00' AND cancel_reason:*", first: 100) {
edges {
node {
id
createdAt
cancelReason
cancelledAt
}
}
pageInfo {
hasNextPage
}
}
}
But actually this query returns all orders after the date specified (2023-04-02) both with null "cancelReason" values and containing text.
My second attempt was to search by cancelled date:
{
orders(query:"cancelled_at:>'2023-04-02T00:00:00'", first: 100) {
edges {
node {
id
cancelReason
cancelledAt
}
}
pageInfo {
hasNextPage
}
}
}
But this query just returns all orders - both with null "cancelledAt" values and any with date populated.
I also tried to put "cancelReason" and "cancelledAt" variables (GraphiQL syntax instead of REST one) for those queries but this doesn't change the query result.
Hi Maxim,
You can't query by cancelled_at with either the graphql or rest api's.
GraphQL supports the following filter parameters only:
cart_token
channel
channel_id
chargeback_status
checkout_token
created_at
credit_card_last4
customer_id
delivery_method
discount_code
earliest_fulfill_by
email
financial_status
fraud_protection_level
fulfillment_location_id
fulfillment_status
gateway
location_id
name
payment_id
payment_provider_id
po_number
processed_at
reference_location_id
return_status
risk_level
sales_channel
sku
source_identifier
source_name
status
tag
tag_not
test
updated_at
Cheers,
Gary