APIs & Integrations

JulienD8
Membre | Partenaire solutions Diamond
Membre | Partenaire solutions Diamond

Find file's URL through association

Résolue

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 Votes
1 Solution acceptée
weiliang_lee
Solution
Contributeur de premier rang | Partenaire solutions Diamond
Contributeur de premier rang | Partenaire solutions Diamond

Find file's URL through association

Résolue

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

 

Voir la solution dans l'envoi d'origine

2 Réponses
weiliang_lee
Solution
Contributeur de premier rang | Partenaire solutions Diamond
Contributeur de premier rang | Partenaire solutions Diamond

Find file's URL through association

Résolue

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
Gestionnaire de communauté
Gestionnaire de communauté

Find file's URL through association

Résolue

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 Votes