Reputation: 3788
Can anyone do an (educated) guess as to how paging works with the unreleased Pinterest API?
For example, this link: https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/ returns the first 50 pins of that specific board. But it contains 101 pins. How do I retrieve page 2 and 3?
Since the API is not actually public, I can't look it up but maybe happens to know or can do a good guess.
I've tried:
https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/page/2/
https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/?page=2
https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/?p=2
https://api.pinterest.com/v3/pidgets/boards/grainedit/cars/pins/?offset=2
Pinterest is based on Django so it probably uses the REST Framework. Any ideas?
Upvotes: 9
Views: 1538
Reputation: 303
You can Paginate in the Pinterest API by adding the parameter limit
CURLing:
https://api.pinterest.com/v1/boards/anapinskywalker/wanderlust/pins/?
access_token=abcde&
limit=2&
fields=id,link,counts,note
This will return two pins, a second object call page will also be returned.
"page": {
"cursor":"abcde1234",
"next":"https://api.pinterest.com/v1/boards/anapinskywalker/wanderlust/pins/?access_token=abcde&fields=id%2Clink%2Ccounts&2Cnote&limit=2&cursor=abcde1234"
}
You can then CURL the next URL to see then next two pins.
Upvotes: 1
Reputation: 1610
Even if they are using some framework (like DRF) they have a million ways to set up the query structure. If I wanted to reverse-engineer some non-published API that was still open I would either use Wireshark or Fiddler2. Then just start using the website and see what sort of requests are being made, figure out the request pattern and build your own API against your ad-hoc API. Another option is simply watching the Network part of Chrome Developer Tools if you just need a general idea.
Upvotes: 0