@kevinchalet and @jsgoupil recently brought to my attention that some endpoints in the SendGrid API return pagination information in a response header called Link. One example of such an endpoint is suppressions/unsubscribes which is the endpoint to retrieve all global suppressions. If you send a GET request to this endpoint, the response includes a Link header which contains information similar to this:
I did a little bit more investigation and I found a few more endpoints that seem to also include this pagination information (this is probably not an exhaustive list, this is just what I found so far):
GET https://api.sendgrid.com/v3/user/webhooks/parse/settings
GET https://api.sendgrid.com/v3/teammates?limit=50&offset=0
GET https://api.sendgrid.com/v3/teammates/pending
GET https://api.sendgrid.com/v3/suppression/spam_reports?start_time=1577854800&end_time=1641013199&limit=25&offset=0
GET https://api.sendgrid.com/v3/whitelabel/links?limit=50&offset=0
GET https://api.sendgrid.com/v3/whitelabel/ips?limit=50&offset=0
GET https://api.sendgrid.com/v3/whitelabel/domains?exclude_subusers=false&limit=50&offset=0
GET https://api.sendgrid.com/v3/ips?exclude_whitelabels=False&limit=10&offset=0&sort_by_direction=asc
GET https://api.sendgrid.com/v3/api_keys
Questions
Would it be possible to confirm if we can rely on this header for pagination information?
Can you confirm which endpoints return this pagination information?
@kevinchalet and @jsgoupil recently brought to my attention that some endpoints in the SendGrid API return pagination information in a response header called
Link
. One example of such an endpoint issuppressions/unsubscribes
which is the endpoint to retrieve all global suppressions. If you send aGET
request to this endpoint, the response includes aLink
header which contains information similar to this:However, we noticed that this is not documented: https://sendgrid.api-docs.io/v3.0/suppressions-global-suppressions/retrieve-all-global-suppressions
I did a little bit more investigation and I found a few more endpoints that seem to also include this pagination information (this is probably not an exhaustive list, this is just what I found so far):
GET https://api.sendgrid.com/v3/user/webhooks/parse/settings
GET https://api.sendgrid.com/v3/teammates?limit=50&offset=0
GET https://api.sendgrid.com/v3/teammates/pending
GET https://api.sendgrid.com/v3/suppression/spam_reports?start_time=1577854800&end_time=1641013199&limit=25&offset=0
GET https://api.sendgrid.com/v3/whitelabel/links?limit=50&offset=0
GET https://api.sendgrid.com/v3/whitelabel/ips?limit=50&offset=0
GET https://api.sendgrid.com/v3/whitelabel/domains?exclude_subusers=false&limit=50&offset=0
GET https://api.sendgrid.com/v3/ips?exclude_whitelabels=False&limit=10&offset=0&sort_by_direction=asc
GET https://api.sendgrid.com/v3/api_keys
Questions