APIs & Integrations

robyn1
Member

Handle Custom Object unique constraint error

Is there a way to reliable identify errors thrown when creating a custom object due to unique constraint/the object already exists?

 

An example error response from a sandbox account is below. Is the error body reliable or possibly differ in the future?

 

 Error: HTTP-Code: 400

 Message: An error occurred.

 Body: {"status":"error","message":"Cannot set         PropertyValueCoordinates{objectTypeId=ObjectTypeId{metaTypeId=2},  propertyName=line_id, value=robyn-test-id} on XXXX259. XXXX905  already has that value.",

  "category":"VALIDATION_ERROR"}

0 Upvotes
2 Replies 2
Jaycee_Lewis
Community Manager
Community Manager

Handle Custom Object unique constraint error

Hi, @robyn1 👋 Are you asking if there is set list of error responses for this endpoint? Or something you can reference?

 

Thanks for clarifying! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
robyn1
Member

Handle Custom Object unique constraint error

Hey @Jaycee_Lewis , I'm looking for  a set list of error responses for this endpoint. I really only need a reliable way to check the error above was thrown. We want to catch this error and respond by using the search endpoint vs throwing in all other instences. 

 

Is the error body text reliable to query or likely to change?

0 Upvotes