Is there any way, using the V4 association API, to place more than one object_id at once, without having to call the API several times?
This is the way I’m currently doing it:
You might like to consider using the List Deals endpoint and specifying Line Items as a target association to be returned. For example:
GET /crm/v3/objects/DEALS?limit=100&associations=LINE_ITEMS
Example response body:
{
"results": [
{
"id": "17614984782",
"properties": {
"amount": "2000",
"closedate": null,
"createdate": "2024-02-19T05:12:58.087Z",
"dealname": "Example Deal",
"dealstage": "xxxxxx",
"hs_lastmodifieddate": "2024-02-22T06:03:54.945Z",
"hs_object_id": "17614984782",
"pipeline": "default"
},
"createdAt": "2024-02-19T05:12:58.087Z",
"updatedAt": "2024-02-22T06:03:54.945Z",
"archived": false,
"associations": {
"line items": {
"results": [
{
"id": "8366375344",
"type": "deal_to_line_item"
},
{
"id": "8399242520",
"type": "deal_to_line_item"
},
{
"id": "8399306032",
"type": "deal_to_line_item"
},
{
"id": "8399306033",
"type": "deal_to_line_item"
}
]
}
}
}
],
"paging": {
"next": {
"after": "17614984783",
"link": "https://api.hubapi.com/crm/v3/objects/DEAL?associations=LINE_ITEMS&limit=1&after=17614984783"
}
}
}
Please note, if you’ll be working with >100 Deals, you’ll have to handle pagination (see ‘paging’ in example response body above).
