APIs & Integrations

altjx
Mitwirkender/Mitwirkende

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

lösung

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 Upvotes
1 Akzeptierte Lösung
altjx
Lösung
Mitwirkender/Mitwirkende

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

lösung

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.

Lösung in ursprünglichem Beitrag anzeigen

0 Upvotes
1 Antwort
altjx
Lösung
Mitwirkender/Mitwirkende

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

lösung

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 Upvotes