Hi!
I have already checked some posts and have some thoughts about what to do, but still need help with resolving the way I should fix it.
I have program that receives data from product by deal id.
Issue related to the deal with 267 products in it.
What i do:
1. I retrive by objectId list of all products ids.
I fetch them by:
https://api.hubapi.com/crm/v3/associations/deal/{objectId}/batch/read
From the response i take array with ids.
And here is the 1st problem - I receive only 100. I see that it can be solved somehow with query parameter after. But how can I understand how much products at all, to function that will by loop get ids products ? Or I miss something here ?
2. Then I make request with each ID to get needed data.
I’m not sure that making promise all with 267 items is good idea, but I don’t know how to do it correctly.
Now I have this:
const productsRequests = recordIdArr.map((recordId) => {
return fetch(
`https://api.hubapi.com/crm/v3/objects/2-45666582/${recordId}${propertiesList}`,
{
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
},
}
).then((response) => response.json());
});
const productsResponses = await Promise.all(productsRequests);
After that I usually have all data from all products. But how to do it with great amount ?
Appreciate any advice how to resolve this.