APIs & Integrations

altjx
Contributeur

How to get a company's phone number via API to the Companies endpoint?

Résolue

According to https://developers.hubspot.com/docs/api/crm/companies, you can get a company's details using the List method. However, this doesn't provide all of the information that I need. In my case, this is all I see:

{
            "id" => "XXX508XXXX",
    "properties" => {
                 "createdate" => "2021-02-03T19:35:59.888Z",
                     "domain" => "XXXXX.com",
        "hs_lastmodifieddate" => "2021-02-04T23:07:12.173Z",
               "hs_object_id" => "52950XXXXX",
                       "name" => "XXXXXXXXXXX, Inc."
    },
     "createdAt" => "2021-02-03T19:35:59.888Z",
     "updatedAt" => "2021-02-04T23:07:12.173Z",
      "archived" => false
}

 

How am I supposed to get the postal code, phone number, etc., from the company?

0 Votes
1 Solution acceptée
altjx
Solution
Contributeur

How to get a company's phone number via API to the Companies endpoint?

Résolue

For anyone else looking for the answer to this question, I was able to finally figure this out (after tons of hours of research) that you have to explicitly specify which additional properties you want to have returned.

 

So, for example, since it doesn't return Annual Revenue, you have to explicitly call "annualrevenue" as a property type. For example:

 

https://api.hubapi.com/crm/v3/objects/companies/XXXXXXXXX?properties=annualrevenue&archived=false&hapikey=YOUR-API-KEY"

 

In the response, you'll see the annual revenue is returned. This, again, isn't a property that's returned when getting information from a company. I assume this is because there are tons (in my case, 132) properties that belong to companies. So in the original HTTP GET request (in the read method), you will get the default properties back unless you explicitly ask for other properties.

Voir la solution dans l'envoi d'origine

0 Votes
1 Réponse
altjx
Solution
Contributeur

How to get a company's phone number via API to the Companies endpoint?

Résolue

For anyone else looking for the answer to this question, I was able to finally figure this out (after tons of hours of research) that you have to explicitly specify which additional properties you want to have returned.

 

So, for example, since it doesn't return Annual Revenue, you have to explicitly call "annualrevenue" as a property type. For example:

 

https://api.hubapi.com/crm/v3/objects/companies/XXXXXXXXX?properties=annualrevenue&archived=false&hapikey=YOUR-API-KEY"

 

In the response, you'll see the annual revenue is returned. This, again, isn't a property that's returned when getting information from a company. I assume this is because there are tons (in my case, 132) properties that belong to companies. So in the original HTTP GET request (in the read method), you will get the default properties back unless you explicitly ask for other properties.

0 Votes