APIs & Integrations

JulienD8
Member | Platinum Partner
Member | Platinum Partner

Find file's URL through association

SOLVE

Hello fellows !

 

I am looking to know how to find the file's public url of an attachement put in a note, in my situation the notes are located in deals exclusively. I would like to use Operation Hub Pro's webhook or custom code.

 

Is there anyway to find it easily ? 

 

After my research, it's look like that I need to make at least 4 api calls from deals to files, is there anyway to make it quickly ? 

 

Thanks for your help ! 

0 Upvotes
1 Accepted solution
weiliang_lee
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Find file's URL through association

SOLVE

Hello @Jaycee_Lewis Thanks for the tag 👋

 

Hey @JulienD8 Thanks for reaching out. I am assuming you already have a particuar Deal ID and you'd want to retrieve all attachments of those notes in that deal.

 

Minimally we'll need 2 api calls.

 

The first call would be an association to the notes using the Search Endpoint:

POST /crm/v3/objects/notes/search

 

The body of your request could be something like so - and the "hs_attachment_ids" property will return all files associated to that note.

{
    "properties": [ "hs_attachment_ids" ],
    "filterGroups": [
        {
            "filters": [
                {
                    "operator": "EQ",
                    "propertyName": "associations.deal",
                    "value": "<insert deal id>"
                }
            ]
        }
    ]
}

 

Once you have them, then the 2nd call would be to fetch from the Files Endpoint:

GET /files/v3/files/{fileId}

 

Would this help in your use case?

 

Cheers

WL

 

View solution in original post

2 Replies 2
weiliang_lee
Solution
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Find file's URL through association

SOLVE

Hello @Jaycee_Lewis Thanks for the tag 👋

 

Hey @JulienD8 Thanks for reaching out. I am assuming you already have a particuar Deal ID and you'd want to retrieve all attachments of those notes in that deal.

 

Minimally we'll need 2 api calls.

 

The first call would be an association to the notes using the Search Endpoint:

POST /crm/v3/objects/notes/search

 

The body of your request could be something like so - and the "hs_attachment_ids" property will return all files associated to that note.

{
    "properties": [ "hs_attachment_ids" ],
    "filterGroups": [
        {
            "filters": [
                {
                    "operator": "EQ",
                    "propertyName": "associations.deal",
                    "value": "<insert deal id>"
                }
            ]
        }
    ]
}

 

Once you have them, then the 2nd call would be to fetch from the Files Endpoint:

GET /files/v3/files/{fileId}

 

Would this help in your use case?

 

Cheers

WL

 

Jaycee_Lewis
Community Manager
Community Manager

Find file's URL through association

SOLVE

Hey, @JulienD8 👋 Thanks for reaching out. Hey, @weiliang_lee @miljkovicmisa, do you have any thoughts here? I don't know of a method that doesn't involve multiple calls.

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes