Did you really changed the “Link” header to “link” ?! Why?
This is breaking change, f.e. /api/2022-10 is affected.
Tested this product and order list enpoints. So i guess all are affected.
Usually this would not be a problem - we could check if the header “Link” is set.
And if the header is missing then we could throw us an exception …
but WAIT - you do not set the header on single entity responses -.- EDIT: and (even worse) you do not add the header on list endpoints if the response is the last page.
VERY bad design IMO.
We just had unexpected behaviour because we received the first page only.
Should have just used a pagination offset in the response - the entities are wrapped in the response body anyway.
Ok, so i tried to make sure that this not happen again.
Header “link” appears with
next page on page 1
next page and previous page on page 2+
previous page on last page
but does not appear if there is just one page.
So you have no way to check if the response should contain the “link” header.
TL:
Note: documentation says at https://shopify.dev/docs/api/usage/pagination-rest#supported-endpoints "Tip You can use the “since_id” parameter that’s available on endpoints that support cursor-based pagination to make requests from a specific point. For example, you can use the “since_id” parameter on the Transaction resource to retrieve only transactions after a specified ID." but this is not true.
F.e. inventory levels got no “since_id”. But it got a “limit”, like all other list endpoint got a limit.
So, you COULD check if the request is a GET and the endpoint accepts “limit” (or you check for all the path …) but it does not matter - as soon you receive f.e. just one entity (so there is just one page) you will not get any “link” header at all.
List endpoints should contain the pagination information always, even if there is no next page.
Thank you so much for this note. It would have taken me forever to dig that out. Just updated my API and I lost my pagination. This little note fixed it.