Development discussions around Shopify APIs
I am trying to use GraphQL to retrieve various information about my orders. My GraphQL schema basically looks like this:
query order {
orders(before: "2021-11-02", after: "2021-01-01") {
edges {
node {
app {
name
}
But I am getting the following error:
you must provide one of first or last
Why is this and how can I get around it? I just want my search results to be filtered by a date period rather than a set count that I have to enforce.
Solved! Go to the solution
This is an accepted solution.
Hi @jlarks32
The before and after parameters limit the range of results, whereas the first/last parameter determines how many results from that range to return at a time, and whether to start at the beginning of the set or the end. This is needed if you're going to paginate through results. Imagine that you have 1500 orders during the 11 month period that you're querying. You can't return all 1500 orders in a single response, so you need to specify how many orders to return at a time, and whether to start with oldest first or newest first. You can read more about how this works in our GraphQL documentation and there is also a post on the partners blog with accompanying video here: https://www.shopify.ca/partners/blog/graphql-pagination
Best,
CS | 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
This is an accepted solution.
Hi @jlarks32
The before and after parameters limit the range of results, whereas the first/last parameter determines how many results from that range to return at a time, and whether to start at the beginning of the set or the end. This is needed if you're going to paginate through results. Imagine that you have 1500 orders during the 11 month period that you're querying. You can't return all 1500 orders in a single response, so you need to specify how many orders to return at a time, and whether to start with oldest first or newest first. You can read more about how this works in our GraphQL documentation and there is also a post on the partners blog with accompanying video here: https://www.shopify.ca/partners/blog/graphql-pagination
Best,
CS | 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
User | RANK |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023