Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm new to using API's and I don't understand pagination enough to get all the data from Planning Center People. I connect, and can get data but depending on the settings I choose for pagination, I get anywhere from 25 to 1632 of 6507 records. I don't understand what I should be doing. The API Explorer Planning Center provides for developers (I'm a wannabe developer) gives this server response:
"root":{ 4 items
"links":{ 2 items
"self": "https://api.planningcenteronline.com/people/v2/people"
"next": "https://api.planningcenteronline.com/people/v2/people?offset=25"
}
I interpreted this to mean I should use Pagination one of these - I've tried both and cannot get all the 6507 records:
I tried various "offset" settings but simply cannot get this to work. Any help anyone can provide would be most appreciated. - super indebted!!
Can you try to add this parameter to your URL?
per_page=100
It will be something like: https://api.planningcenteronline.com/people/v2/people?per_page=100
Sorry again, I can't test myself to give you the right answer. Going blind here!
Hi @DrB1,
I don't have access so far to this API, but it looks similar to one that I did before. Can you please try this on your REST API Connection? Don't worry about Offset or anything else. You should be good.
@marksouzacosta It errors out -
I think that indicates the pagination is working. But the number of records per call is small compared to the total number of records you have, so you are reaching the limit of requests. I found some details here:
https://developer.planning.center/docs/#/overview/rate-limiting
Let me try to find a better way to get that...
Can you try to add this parameter to your URL?
per_page=100
It will be something like: https://api.planningcenteronline.com/people/v2/people?per_page=100
Sorry again, I can't test myself to give you the right answer. Going blind here!
Yes, @marksouzacosta !! Adding the per_page=100 to my URL worked! Thank you so much!
You are very welcome.
@marksouzacosta I am learning that in addition to the first url which is considered the "person" data set ( https://api.planningcenteronline.com/people/v2/people?per_page=100) there are 60 or 61 additional urls that contain additional data for each person, for example, https://api.planningcenteronline.com/people/v2/addresses, or
https://api.planningcenteronline.com/people/v2/anniversary_couples
I've been reading about ways to loop through the urls to get complete data sets for each person. I've so new at this I'm not sure if it's possible or how to do it. Any thoughts?
Hi @DrB1,
Yes, it is possible. I have created a video before that talks about pagination and association between multiple REST API Calls manipulating the WITH CONNECTION attribute from REST Connections and looping. Everything is explained here: https://youtu.be/lFwar30BNkQ?si=7gkyCQAiS1wtT4Yj
You just need to adapt to your REST API Endpoints.
I hope it helps!
Regards,
Mark Costa
Oh and @DrB1, I noticed some of the data you can add to your People Endpoint request. For instance, to add the addresses and emails, you can change your URL to add include=addresses,emails:
Example: https://api.planningcenteronline.com/people/v2/people/150356435?include=addresses,emails
This is the list of data sets you can include: