I want to update the entries of my custom object using one of its unique properties. I made a custom object customer pet. I want to update it based on the customer ID property. That property comes from my database, not HubSpot. The customer ID is unique and identifies each pet one-to-one. How do I update this record without knowing the record Object ID or any other Hubspot-generated ID?
Hey @DarMan,
You can include “idProperty” as a query parameter in your request when updating the custom object so that you are referencing one of the unique values as needed. The request would look like this:
PATCH https://api.hubapi.com/crm/v3/objects/{objectTypeId}/{someValue}?idProperty={your_unique_property}
For example, I have a custom object called “Licenses” and I’ve created a unique property called “External ID”. I can update any of the custom objects using the external ID as the identifier by doing this:
PATCH https://api.hubapi.com/crm/v3/objects/2-116144016/X1010?idProperty=external_id
BODY
{
"properties":{
"license_type": "Enterprise"
}
}
RESPONSE
{
"id": "1669847002",
"properties": {
"hs_created_by_user_id": "4592290",
"hs_createdate": "2023-07-19T08:53:07.950Z",
"hs_lastmodifieddate": "2023-08-07T07:54:40.587Z",
"hs_object_id": "1669847002",
"hs_updated_by_user_id": "4592290",
"license_type": "Enterprise"
},
"createdAt": "2023-07-19T08:53:07.950Z",
"updatedAt": "2023-08-07T07:54:40.587Z",
"archived": false
}
In the example above X1010 is the value in the “External ID” property associated to the custom object License which as an ObjectTypeID of “2-116144016”.
I hope this helps!
It worked, thank you. I don’t need to know the exact record ID. X1010 is the stand-in for my target value, i.e. in the example the Licenses record with “External ID” = X1010 would be updated. Its license would be changed to “Enterprise.”