Cannot create deal through API

I’m trying to create a deal with this JSON:

{“associations”:[{“associatedVids”:[8984]}],“properties”:[{“value”:“Test deal”,“name”:“dealname”},{“value”:“782583”,“name”:“dealstage”},{“value”:“1569402361”,“name”:“renewal_date”},{“value”:“331.36”,“name”:“amount”},{“value”:“1569402361”,“name”:“closedate”},{“value”:“19821452”,“name”:“hubspot_owner_id”}]}

but i’m receiving this error:

{“status”:“error”,“message”:“properties cannot be null”,“requestId”:“e04191ec-5935-42c0-854e-2acc5697d972”}

I already setted all the required fields but i still can’t create a deal through the API.

What should I do?

Thanks

Hi @nutritics,

I took a look at your request body; thanks for including that. I believe what’s happening here is that the API is expecting a different format for the associations field. It’s expecting an object of arrays. What you’ve got in your JSON above is an array of objects containing an array. When I follow your format, I reproduce the error you’re seeing.

So I think to get your deal created, you can pass this in as the body of your request:

{
 "associations": {
 "associatedVids": [
 8984
 ]
 },
 "properties": [
 {
 "value": "Test deal",
 "name": "dealname"
 },
 {
 "value": "782583",
 "name": "dealstage"
 },
 {
 "value": "1569402361",
 "name": "renewal_date"
 },
 {
 "value": "331.36",
 "name": "amount"
 },
 {
 "value": "1569402361",
 "name": "closedate"
 },
 {
 "value": "19821452",
 "name": "hubspot_owner_id"
 }
 ]
}

Let me know if that clears up the error or if you have any other questions here.

That was the problem.

Many thanks Leland!