Oct 26, 202111:41 AM - edited Oct 27, 20214:17 AM
Participant | Elite Partner
Pagination on Associations v3 Batch API does not return the next page of associations
SOLVE
Hi,
I am trying to fetch all associated line items of a deal, for this I use the V3 Associations API. The deal I am querying has a lot of line items (268). According to the documentation, if there are more than 100 associations found, they will be paginated in pages of 100 each.
So I start by making the request below to get the first page of 100 associated line items:
The first request runs correctly and returns the first 100 line items associated to the deal. The response also provides the pagination data.
When adding the pagination data to the request body, the same 100 associated line items are returned with the same "after" value. So the pagination does not seem to be working on the Associations Batch API.
However, when querying the endpoint provided by the "link" property, the next 168 associated line items are returned without further pagination. I also noticed that the "link" contains an endpoint from the CRMv3 Objects API and not the Associations API.
Thank you for having taken the time to reply, the workaround you suggested would not work for my use case because at the time I am querying the associations, I have no way of knowing which are the line item IDs.
I have, however, found that by adding a "limit=100" query parameter to the Objects API endpoint (/crm/v3/objects/deal/{{dealId}}/associations/line_items?limit=100), that I can use the pagination correctly.
I had the same issue but with the company/contacts association. Firstly, I tried to fetch all the companies assigned to each contact, and I faced the same issue as you. Sadly, I did not find a solution since I am using a get_all() command.
However, once I did the other way around company -> contacts, I was able to get everything since there was a lesser amount of associated records. Maybe that helps you
Thank you for having taken the time to reply, the workaround you suggested would not work for my use case because at the time I am querying the associations, I have no way of knowing which are the line item IDs.
I have, however, found that by adding a "limit=100" query parameter to the Objects API endpoint (/crm/v3/objects/deal/{{dealId}}/associations/line_items?limit=100), that I can use the pagination correctly.