APIs & Integrations

WBHydrosense
Participant

Get all note IDs from a specific company ID

SOLVE

Hello, 

 

Was hoping someone could lend a hand - I am looking to fetch a list of all NOTE engagement IDs of a specified company ID. 

 

I have this working to retrieve emails but just struggling to get notes. 

 

Currently, I am using a combination the legacy  and V3 to achieve this with emails;

 

I query with the following link

https://api.hubapi.com/crmassociations/v1/associations/{COMPANYID}/HUBSPOT_DEFINED/7

 

This retrieves all engagement ids for specified company ID

 

I then use a V3 API to retrieve the email body of the specified engagement id

 

https://api.hubapi.com/crm/v3/objects/emails/{ENGAGMENT ID}?properties=hs_email_text&archived=false&hapikey=XXXX

 

Any help on achieving what I have with emails for NOTES would be massively appreciated - also open to any suggestions on how to improve my current process for emails

 

Thank you very much in advance 

 

Will

0 Upvotes
2 Accepted solutions
dennisedson
Solution
Community Manager
Community Manager

Get all note IDs from a specific company ID

SOLVE

@WBHydrosense 

You could use the "Read a batch of association" on the Associations API

Or, you could go crazy and use the Associations Beta API

With V3, you would make a post request like this:

https://api.hubapi.com/crm/v3/associations/companies/notes/batch/read

and a json body like this:

 

{
    "inputs": [
        {
            "id": "ID OF COMPANY HERE"
        }
    ]
}

 

Using the V4 endpoint:

https://api.hubapi.com/crm/v4/objects/companies/COMPANYID/associations/notes

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show

View solution in original post

0 Upvotes
WBHydrosense
Solution
Participant

Get all note IDs from a specific company ID

SOLVE

Absolute Genius! Thank you very much Dennis!

 

Decided to take a slightly different approach in the end 

 

I used the below call to loop through and query all engagements for a specific company ID and then filtered by engagement type to 'notes, emails meetings, tasks'

 

https://api.hubapi.com/engagements/v1/engagements/associated/COMPANY/{COMPANY ID}/paged

 

Thanks again!

 

Will

View solution in original post

2 Replies 2
dennisedson
Solution
Community Manager
Community Manager

Get all note IDs from a specific company ID

SOLVE

@WBHydrosense 

You could use the "Read a batch of association" on the Associations API

Or, you could go crazy and use the Associations Beta API

With V3, you would make a post request like this:

https://api.hubapi.com/crm/v3/associations/companies/notes/batch/read

and a json body like this:

 

{
    "inputs": [
        {
            "id": "ID OF COMPANY HERE"
        }
    ]
}

 

Using the V4 endpoint:

https://api.hubapi.com/crm/v4/objects/companies/COMPANYID/associations/notes

Thanks,

Dennis




HubSpot Community Developer ShowMake sure to subscribe to our YouTube channel
where you can find the HubSpot Community Developer Show
0 Upvotes
WBHydrosense
Solution
Participant

Get all note IDs from a specific company ID

SOLVE

Absolute Genius! Thank you very much Dennis!

 

Decided to take a slightly different approach in the end 

 

I used the below call to loop through and query all engagements for a specific company ID and then filtered by engagement type to 'notes, emails meetings, tasks'

 

https://api.hubapi.com/engagements/v1/engagements/associated/COMPANY/{COMPANY ID}/paged

 

Thanks again!

 

Will