Hello! I’m trying to query the last 2 most recent inventory snapshots via the API, but no matter what I’ve tried, I always gets results that are years old, either from 2020 or 2021. We’re definitely running one at least every day because I received the emails to download them when they’re complete. The query I’m trying is:
query {
inventory_snapshots {
request_id
data (sort: "-created_at", first: 2) {
edges {
node {
snapshot_id
status
created_at
snapshot_url
}
}
}
}
}
This should be sorting created_at in descending order and returning the first 2 snapshots. I’ve also tried a number of variations of the sort and first fields, such as sorting created_at in ascending order and requesting the last 2. I pulled the sort syntax from this post. I also looked through the developer docs site, and sort syntax doesn’t seem to really be specified there, either. I did see one reference to sorting in the examples page under “Cycle Count Create”, which shows examples of the sort field as “LOCATION_NAME_ASC” and “QUANTITY_DESC”. Based on those, I tried using “CREATED_AT_ASC” and “CREATED_AT_DESC” syntax in my query, but those didn’t do anything to change the sort, either.
Here are some of my request_ids:
6a674870e13ef742ed5386bd
6a6748e68995d911dea206de
6a6749cfefe9fc2901b93cf7
Along with receiving help with this, I would also like to suggest to please incorporate documentation and examples for how to use the sort field in queries, especially if the syntax is different between queries and mutations. It would also be extremely helpful if the GraphQL schema documentation could specify which fields are sortable in each query and mutation.
Thank you,
Jeremy