When retrieving the social history for a connected account, the amount of data can be extensive. To manage this efficiently and ensure fast response times, the Social Account Feed endpoint utilizes cursor-based pagination to retrieve posts in manageable chunks.
Here is a breakdown of how to control your batch sizes and navigate through the user's history.
Controlling Result Size
You can control the number of items returned in a single request by utilizing the limit parameter.
The Parameter
By default, the endpoint returns a set number of posts (usually 50). You can adjust this by passing ?limit=X in your query string.
Platform Limits:
It is important to note that every social platform (e.g., Instagram, YouTube) enforces its own maximum page size.
The Logic: If the
limityou provide is higher than what the specific platform allows, we will automatically default to the maximum limit allowed by that platform.The Result: You may receive fewer items than requested, but you will never receive an error for requesting too many.
Navigating with Cursors
To retrieve the next set of results, you must use the cursor parameter. Unlike internal endpoints that may use numbered offsets, external social feeds rely on opaque cursor strings to track position in the timeline.
How it works
Check the Meta: Every response includes a
metaobject. Check thehas_moreboolean to see if additional posts exist.Get the Cursor: If more data is available, extract the
cursorstring from themetaobject.The Next Request: Pass this string as the
cursorquery parameter in your subsequent request to fetch the next page.
The Helper
To make this even easier, the meta object also includes a pre-built next URL, which already contains the correct cursor and limit settings for the following page.