APIs & Integrations

RonaldoRubens22
メンバー

Use association api with more than one object_id

解決

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:

 

RonaldoRubens22_0-1709137856220.png

 

0 いいね!
1件の承認済みベストアンサー
zach_threadint
解決策
トップ投稿者

Use association api with more than one object_id

解決

Hi @RonaldoRubens22 👋

 

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).

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.


元の投稿で解決策を見る

1件の返信
zach_threadint
解決策
トップ投稿者

Use association api with more than one object_id

解決

Hi @RonaldoRubens22 👋

 

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).

All the best,

Zach

--

Zach Klein
HubSpot Integrations & App Developer
Meanjin / Brisbane, Australia



Say g'day


If my post helped answer your query, please consider marking it as a solution.