APIs & Integrations

RonaldoRubens22
Miembro

Use association api with more than one object_id

resolver

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 Me gusta
1 Soluciones aceptada
zach_threadint
Solución
Guía

Use association api with more than one object_id

resolver

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.


Ver la solución en mensaje original publicado

1 Respuesta 1
zach_threadint
Solución
Guía

Use association api with more than one object_id

resolver

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.