Batch Read a set of contacts by "internal ID or unique property values" limited to email?

DRSBLD
Member

I am attempting to read properties for a set of contacts using their VID/hs_object_id, as the description of the call reads like this would be possible:

 

POST/crm/v3/objects/contacts/batch/read

Read a batch of contacts by internal ID, or unique property values

 

However, when I make the call using the hs_object_id as the idProperty I get an error message that says I can only use email. 

 

I can perform the request using API v1, or make the call work by using the email value, but is the batch contact read call limited to email only?

 

Request response:

 

HTTP 400

{
"status": "error",
"message": "Contacts may only be looked up by 'email' as part of a unique property value request. Property requested: hs_object_id",
"correlationId": "4c55e389-a54f-4d0e-a466-8828870bd4ac"
}

 

6 Replies 6
dennisedson
Community Manager

Hello @DRSBLD !

Thanks for reaching out.  V3 is still being built out.  Getting closer, but still not complete.   I would keep my eyes peeled for updates around this.  Unfortunately, I do not have a timeline to share. 

 

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
ES05
Participant

Hi @dennisedson, I am also looking around for this idProperty to be the internal ID. Is there any update on this? 

0 Upvotes
dennisedson
Community Manager

 

@ES05 , not yet

 

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
Jannik
Member

Hi @dennisedson!

I happened to run into the same issue with the v3 basic API (non-batch) for contacts. The documentation under idProperty states:

"The name of a property whose values are unique for this object type"

 

I understand this as to be applicable to any assigned property that uniquely identifies a contact. Our contacts have properties assigned under the name meteor_user_id. This property is unique to any contact. However, when I send a request with idProperty=meteor_user_id and contactId=<some_unique_meteor_user_id> I receive an error:

"Contacts may only be looked up by 'email' as part of a unique property value request. Property requested: meteor_user_id"

 

I cannot find any definitve information about the API stability, but the banner at the top of the CRM contacts API docs states:

"All other Contacts API endpoints are in general availability. "

 

This leaves me wondering whether the issue is still around or I simply don't use the API correctly.

0 Upvotes
jtambunt
Member

I'm running into the same issues as others. The api docs under https://developers.hubspot.com/docs/api/crm/contacts  read:

Read a batch of contacts by internal ID, or unique property values

Is this not up to date? If we have to use the email as the unique identifier, how should we pass in data? Is this correct?:

 

 

{
    properties: ['some_property', 'email'],
    idProperty: 'email',
    inputs: [{
        id: 'some-email@email.com'
    },
    {
        id: 'some-email-2@email.com'
    }],
}

 

 

 
0 Upvotes
DRSBLD
Member
As far as I know, we still need to use emails as the unique identifier.
 
This isn't as clear as it could be, but this is the code I use to request data using an array of email addresses (in JS): 
 
for var i = 0i < emailRange.lengthi++)
  {
      emailArray.push( { "id"emailRange[i][0] } )
  }
 
var data = {
        "inputs": emailArray,
        "properties": [
          "hs_object_id",
          "lastname",
          "firstname",
          "cust_id",
        ],
        "idProperty":"email"
    }
    
    var options = {
      'method' : 'post',
      'contentType''application/json',
      'headers' : {'Authorization''Bearer ' + service.getAccessToken()},
      'muteHttpExceptions' : true,
      'payload' : JSON.stringify(data)
    };
  
    var response = UrlFetchApp.fetch(url,options);
0 Upvotes