Get list of all subscribers using REST API

演友 崔
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 5, 2022

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.

1 answer

0 votes
Alan Violada
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 6, 2022

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://javascript.plainenglish.io/this-is-how-you-can-retrieve-all-data-via-paginated-api-calls-in-vanilla-javascript-a8258e208ea0

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!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events