APIs & Integrations

tberneman
Member

Creating a new Deal with Custom Fields

I need to create a new deal with some custom data from our Accounting software using the API in addition to the normal data and I get the error: "Invalid input JSON on line 1, column 15: Cannot deserialize instance of `java.util.LinkedHashMap` out of START_ARRAY token","correlationId":"d9bba057-0369-47ab-984a-f485fbda4b8d"}"

 

The endpoint is https://api.hubapi.com/crm/v3/objects/deals?hapikey={mykey} and the payload is "{\"properties\":[{\"dealname\":\"Tims Test A\",\"pipeline\":\"2907608\",\"dealstage\":\"2907611\"}]}"

 

What am I doing wrong? Can you provide the correct payload syntax?

 

Follow up question #1: Should I use the id's (ie: "2907608") or the actual text (ie: "Accounting Pipeline")?

 

Follow up question #2: What's the payload syntax to add a custom field we have, "Sales Order Number" (from our accounting software) to the payload?

 

PS: I can create the Deal successfull using Postman with just the 3 main fields (dealname, dealstage, pipeline) BUT it just populates the dealname, the dealstage and pipeline are null. What am I doing wrong?

2020-10-30 11_17_22-Postman.png

0 Upvotes
2 Replies 2
tberneman
Member

Creating a new Deal with Custom Fields

I'll try this out and get back to you. I've tried doing just dealname, dealstage, and pipline and it creates the deal but the dealstage and pipeline are null/blank.

0 Upvotes
dennisedson
HubSpot Product Team
HubSpot Product Team

Creating a new Deal with Custom Fields

Hello, @tberneman 

Looking at your payload, I am seeing an extra [ ] wrapping the json.

This is the code I used

{
    "properties": {
        "dealname": "Test Deal",
        "dealstage": "2916808",
        "pipeline": "2916807",
        "sales_order_number": "yes!!"
    }
}

As for the custom fields, you will need to add  those custom properties in your settings area.  When you create the custom property, make sure to get the internal value as well.  You can see in my example code above, the internal value will have no spaces. 

You can use either id or the text for the deal stage and pipeline. 

0 Upvotes