APIs & Integrations

KLeswing
Member

Using Both Company / Contact Batch Read APIs

I am having an issue using the endpoint:

https://api.hubapi.com/crm/v3/objects/companies/batch/read

 

My problem is that using this simple JSON request:

 

 { "properties": [ "domain" ], "idProperty": "domain", "inputs": [ { "id": "aspencot.co.uk" } ] } 

 

I always seem to get this response...

 

 { "status": "COMPLETE", "results": [], "numErrors": 1, "errors": [ { "status": "error", "category": "OBJECT_NOT_FOUND", "message": "Could not get some COMPANY objects, they may be deleted or not exist. Check that ids are valid.", "context": { "ids": [ "aspencot.co.uk" ] } } ], "startedAt": "2024-02-26T18:49:55.761Z", "completedAt": "2024-02-26T18:49:55.790Z" } 

 

Now I checked the "hasUniqueValue" property of the domain property of the customer and it is presently set to false.  Reading a different post here on the forums, it appears that in order for me to use this endpoint with that 'idProperty' within the JSON request that this attribute needs to be set to true.  (I checked the object using the properties API).

 

HOWEVER, I can successfully use the same batch read contact API endpoint below with the email id property where the "hasUniqueValue" is false and get a successful response when passing the email address in the inputs array.

 

https://api.hubapi.com/crm/v3/objects/contact/batch/read

Is there something else here I am missing in...

 

If my only possible way of doing this is to set the 'hasUniqueValue' attribute to true, what are the existing rammifications to my data already captured in the 60K company records I have in HubSpot?

 

Any guidance here is greatly appreciated.

 

 

 

 

4 Replies 4
GRajput
Key Advisor | Platinum Partner
Key Advisor | Platinum Partner

Using Both Company / Contact Batch Read APIs

Hi @KLeswing 

To read the company use the following API curl, where hs_object_id

reference - hs_Object_id = company_id

 

curl --location 'https://api.hubapi.com/crm/v3/objects/companies/batch/read?archived=false' \
--header 'authorization: Bearer ACCESS TOKEN' \
--header 'content-type: application/json' \
--data '{
  "idProperty": "hs_object_id",
  "inputs": [
    {
      "id": "1234567"
    }
  ],
  "properties": [
    "domain"
  ]
}'

 

 

To read the contact use the following API curl,

 

curl --location 'https://api.hubapi.com/crm/v3/objects/contacts/batch/read?archived=false' \
--header 'authorization: Bearer ACCESS TOKEN' \
--header 'content-type: application/json' \
--data '{
  "idProperty": "email",
  "inputs": [
    {
      "id": "email address"
    }
  ],
  "properties": [
    "email","firstname","lastname"
  ]
}'

 

I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.
Thanks!




Gaurav Rajput
Director, MarTech( Growth Natives)

Book a meeting


0 Upvotes
KLeswing
Member

Using Both Company / Contact Batch Read APIs

@GRajput Thank you for your two examples but I need the ability to find the Company object (hs_object_id) by passing the domain name to the batch read; not the other way around.  And, when I try by using the aforementioned JSON structure where I am passing the domain and setting the idProperty : "domain".  I get nothing.

0 Upvotes
hli6
Member

Using Both Company / Contact Batch Read APIs

What is the maximum capacity of this batch of calls at one time?

0 Upvotes
KLeswing
Member

Using Both Company / Contact Batch Read APIs

@hli6 I am only making one batch call at a time looking to pass one domain value to find the one company object.

0 Upvotes