Hello,
I heard there is a changes in the use of REST API.
・Upcoming changes to enforce pagination for Statuspage's authenticated REST API
https://community.atlassian.com/t5/Statuspage-articles/Upcoming-changes-to-enforce-pagination-for-Statuspage-s/ba-p/2089947
I'm saving a list of email addresses of all subscribers to a file with the following command.
curl https://api.statuspage.io/v1/pages/{page_id}/subscribers \
-H "Authorization: OAuth your-api-key-goes-here" \
-X GET |sed 's/"id"/\n/g' |awk -F\" '{print $12}' |grep -v ^$ > /tmp/subscriber_list.txt
but, Looking at the document below, I realized that from February 28, 2023,
I can no longer acquire all subscribers with the above command(It looks like that I can get subscribers up to 100)
Is my understanding correct?
If yes, how can I get a list of all subscribers?
・Get a list of subscribers
https://developer.statuspage.io/#operation/getPagesPageIdSubscribers
Thanks.
Hey there, Alan from the Statuspage support team here, thanks for reaching out with this question. There are many different ways to implement this, but essentially to get all page subscribers in the case that you have more than 100, some kind of recursion or iteration would need to be applied to loop the requests until you reach the last page. The response header for endpoints that are paginated should contain the LINK header, which can be used to reach the next page in your iteration. Some possibly useful links on the topic:
https://ethancbanks.com/how-to-pass-api-query-parameters-in-a-curl-request/
https://developer.atlassian.com/server/confluence/pagination-in-the-rest-api/ (While not related to the Statuspage API, the logic is similar)
Hopefully the above is helpful, let us know if you have any questions!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.