How to correctly use ETag with the paginated responses in REST API #24687
-
Hello all, I’m trying to implement ETag usage, but I was unable to find information on how to correctly use ETag for paginated responses. For example, I send the following request (assuming that the answer has more than 20 entries):
GitHub response 1 is:
From the ‘Link’ field I get a request for the next page and send it:
GitHub response 2 is:
… and so on. Now I want to use ETag to get the data again, and send the following request:
The GitHub response is:
My question is – how I should interpret the GitHub answer:
Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Thanks for the question. The ETag is returned per page and is only applicable to the resources in that page (so your interpretation In general, I would recommend conditional requests with large page sizes, and webhooks when possible. Read more here: |
Beta Was this translation helpful? Give feedback.
-
Hi John, Thank you for the confirmation. Also, it seems that we have to cache the next page link too, as it is absent in the 304 response. Thank you again for the clarification, it really helped us to implement this feature correctly. |
Beta Was this translation helpful? Give feedback.
Hi @denis-bigbrassband-com 👋
Thanks for the question. The ETag is returned per page and is only applicable to the resources in that page (so your interpretation
1
).In general, I would recommend conditional requests with large page sizes, and webhooks when possible.
Read more here: