CRM

sgupta046
Member

How to get all the note Ids for a given file Id using API ?

SOLVE

I want to know the notes which are using a particular file, and thus want the list of all noteIds associated with a file (i.e. noteIds for all the note which are having file as an attachment)  using Hubspot API.

Currently API available is to get the attachment id for a particular note.

1 Accepted solution
tnguyen_cbb
Solution
Participant

How to get all the note Ids for a given file Id using API ?

SOLVE

Hey I found the solution,

 

I'm using the Search endpoint. First of all you will need the id of the particular file you want, I got it per the file API.
Now you can call the search endpoint from the notes and filter for "hs_attachement_ids" as propertyName which should equal the value of your file id.

This is how it looks in Python:

 

 

public_object_search_request = PublicObjectSearchRequest(filter_groups = [{"filters": [{"propertyName": "hs_attachment_ids", "operator": "EQ", "value": "109060942534"}]}])
                        
api_response = client.crm.objects.notes.search_api.do_search(public_object_search_request=public_object_search_request)

 

 

 

This should get you all notes now which contains the specified file.

 

View solution in original post

0 Upvotes
5 Replies 5
tnguyen_cbb
Solution
Participant

How to get all the note Ids for a given file Id using API ?

SOLVE

Hey I found the solution,

 

I'm using the Search endpoint. First of all you will need the id of the particular file you want, I got it per the file API.
Now you can call the search endpoint from the notes and filter for "hs_attachement_ids" as propertyName which should equal the value of your file id.

This is how it looks in Python:

 

 

public_object_search_request = PublicObjectSearchRequest(filter_groups = [{"filters": [{"propertyName": "hs_attachment_ids", "operator": "EQ", "value": "109060942534"}]}])
                        
api_response = client.crm.objects.notes.search_api.do_search(public_object_search_request=public_object_search_request)

 

 

 

This should get you all notes now which contains the specified file.

 

0 Upvotes
PamCotton
Community Manager
Community Manager

How to get all the note Ids for a given file Id using API ?

SOLVE

Hey @sgupta046, thank you for posting in our Community!

 

Use the existing API endpoint to get the attachment IDs associated with the file ID you're interested in. This is the current API you mentioned. Once you have the attachment IDs, you can then use another API endpoint to retrieve the note IDs associated with those attachment IDs.

 

To our top experts @Anton and @franksteiner79 do you have any recommendations for @sgupta046 matter?

 

Thank you,

Pam

Você sabia que a Comunidade está disponível em outros idiomas?
Participe de conversas regionais, alterando suas configurações de idioma !


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Upvotes
sgupta046
Member

How to get all the note Ids for a given file Id using API ?

SOLVE

Can you let me know the API to get noteIds associated with a particular attachment Id.

0 Upvotes
PamCotton
Community Manager
Community Manager

How to get all the note Ids for a given file Id using API ?

SOLVE

Hey @sgupta046 To retrieve all note IDs associated with a specific attachment ID in HubSpot using the API, you would typically utilize the HubSpot CRM Associations API. This API allows you to fetch associations between different types of objects, such as contacts, companies, deals, and attachments. Specifically, you'll want to focus on the GET /crm-associations/v1/associations endpoint.

 

Kindly,

Pam

Você sabia que a Comunidade está disponível em outros idiomas?
Participe de conversas regionais, alterando suas configurações de idioma !


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Upvotes
sgupta046
Member

How to get all the note Ids for a given file Id using API ?

SOLVE

Hey @PamCotton, I have read the entire documentation, but there is no API in associations for getting all noteIds associated with attachment. This association API is for objects like deals,tickets, notes, etc. and attachment is not an object.

Also my use case is to get all the noteIds for a particular attachmentId (not the vice versa of it). The issue is to get attachment Ids, I need to make 2 API calls.
First, get all the engagement ids(noteIds) for a particular deal(object). Second, for each engagementId (by iterating each one of them) and check whether that particular attachment Id is there or not (by making another API call). And this complete operation is time taking. 

So I just need an API (if there is any) from which I can directly get all the noteIds for a particular attachment.

0 Upvotes