Inserting CRM Custom Object Record API Error

SOLVE
pawanarora
Member

Hi Community,

I have created a CRM Custom Schema i.e. Applications successfully. Now, I am trying to insert a Custom Object (Record) into this schema by using following API in PHP:

 crm/v3/objects/<objectType>/?hapikey=********************

 But it is showing me the following:

Response: 

Status: Error,

Message: Error creating applicationofcontact. Some required properties were not set.

Context: properties":["property1","property2","property3","property4"]

category: VALIDATION_ERROR

 

But if I pass the same values into Create section at https://developers.hubspot.com/docs/api/crm/crm-custom-objects along with objectType and API Key then it inserts the record with the same values of all properties of this object.

 

Please advise me to fix it.

 

Thanks and regards,

Pawan Arora

0 Upvotes
1 Accepted solution

Accepted Solutions
miljkovicmisa
Solution
Top Contributor | Gold Partner

Hello @pawanarora , thanks for writing here.
Let's take it step-by-step.
1. First you created the schema by "POST"ing to /crm/v3/schemas/{your-custom-object-name}?hapikey=********************
In this post I assume you defined all the data that you needed for your custom object, such as all its properties and the required properties as well.
Just clarifying that this is a one time thing you are doing to create a custom object. I usually just define it using postman or whatever, as I don't need it running in my app.
2. Then you want to create a new custom object. Here you need to define all the properties of that object alongside the required ones. You do this by "POST"ing to/crm/v3/objects/{your-custom-object-name}?hapikey=********************  with the data you defined in the previous post. So for example if you had a property named "model" that was a type of "string" and was required, you should now put in the body of your request that data like:

 

 

{"properties":
  {"model":"ex-9000"}
}

 

 


Maybe I could be of more help if you presented more data of your usecase and see what's going on, I'm just starting with the basics because most errors are in the more obvious (easier to debug) places.

If my answer was helpful please mark it as a solution.

View solution in original post

0 Upvotes
2 Replies 2
miljkovicmisa
Solution
Top Contributor | Gold Partner

Hello @pawanarora , thanks for writing here.
Let's take it step-by-step.
1. First you created the schema by "POST"ing to /crm/v3/schemas/{your-custom-object-name}?hapikey=********************
In this post I assume you defined all the data that you needed for your custom object, such as all its properties and the required properties as well.
Just clarifying that this is a one time thing you are doing to create a custom object. I usually just define it using postman or whatever, as I don't need it running in my app.
2. Then you want to create a new custom object. Here you need to define all the properties of that object alongside the required ones. You do this by "POST"ing to/crm/v3/objects/{your-custom-object-name}?hapikey=********************  with the data you defined in the previous post. So for example if you had a property named "model" that was a type of "string" and was required, you should now put in the body of your request that data like:

 

 

{"properties":
  {"model":"ex-9000"}
}

 

 


Maybe I could be of more help if you presented more data of your usecase and see what's going on, I'm just starting with the basics because most errors are in the more obvious (easier to debug) places.

If my answer was helpful please mark it as a solution.

View solution in original post

0 Upvotes
pawanarora
Member

@miljkovicmisa 

Thanks for your support and there was an issue that "property" key was missing in Json input.

 

Thanks__

0 Upvotes