I’m getting the same error using @hubspot/api-client and trying to get a contact using the idProperty of email.
Can anyone share how it’s supposed to be done with the api-client? It works fine with ?idProperty=email using the REST api, but we need to migrate to the api-client.
If anyone has figured this out it would be highly appreciated!
@dennisedson@Teun@Chrintz Ok I figured this out. I could not find any documentation and some of the StackOverflow comments are completely wrong, but through a lot of trial and error, I was able to figure out what you need to do.
You CAN use email as the idProperty for the hubspot/api-client get contact function, but it only works if you fill in all the other query fields before idProperty, even if they are undefined.
Here is my example of a getContactByEmail as a Google Cloud Function in Node, using the api-client, and it works great!
This looks like exactly what I need! since I need some more details on how the response looks like, since I using a different language (Python) are you around to answer?
xxx@yyy.com is the email ID you use to find the record. Its amazing that this simple and basic instructions are not included in the documentation of the API interface.
Your problem has already been solved, but if somebody like me uses google and finds your thread it could be helpful for that person.
Cheers!
The original question—how to update a contact using email address as the idProperty—has not been addressed. The solution presented shows how to get a contact using email address as idProperty, which works fine. When I use (copied from the codebase on GitHub):
# Update
# Perform a partial update of an Object identified by `{contactId}`. `{contactId}` refers to the internal object ID. Provided property values will be overwritten. Read-only and non-existent properties will be ignored. Properties values can be cleared by passing an empty string.
# @param contact_id [String]
# @param simple_public_object_input [SimplePublicObjectInput]
# @param [Hash] opts the optional parameters
# @option opts [String] :id_property The name of a property whose values are unique for this object type
# @return [SimplePublicObject]
def update(contact_id, simple_public_object_input, opts = {})
data, _status_code, _headers = update_with_http_info(contact_id, simple_public_object_input, opts)
data
end
"status":"error","message":"Object not found. objectId are usually numeric."
I’m able to update custom objects similarly using idProperty, but not contacts. I really don’t want to have to fetch a contact to get its hs_object_id every time I push an update. The “solution” here implies doing a GET to fetch a contact and then use its objectId for updates.