Does the APIv2 posts endpoint support sorting or tail?

I’m experimenting with the new-ish v2/campaigns/{campaign_id}/posts API endpoint for retrieving a creator’s posts. Thanks for adding that! We’ve desperately needed a way to get posts from the API for a while now, especially since the Cloudflare rules changes broke the unofficial APIs.

By default the results appear to be sorted by ID ascending, so the campaign’s oldest posts are first. I want to get the most recent 10 or so posts for a campaign with thousands of posts, and following the pagination links all the way to the end would be horribly inefficient for that use case.

Is there a way to sort the results of the posts endpoint newest first? If not, is there a way to ask the pagination system for the last 10 results?

I’ve tried guessing values for the sort parameter to no avail, e.g. ?sort=-id and ?sort=-published_at. I’m not getting 400 errors like the JSON:API spec says I should for invalid sort keys, so I’m guessing that sorting isn’t implemented at all.

1 Like