APIs & Integrations

gsconover
Member

Insert Contact Via API Generates Nondescript Error

Submitting a request to insert a contact through the API and getting a "property cannot be missing or null" message - with no indication of what property is the problem. Can the returned errors be amended to include which property is the problem?

 

Here's the whole response from HubSpot:

{""message"":""property cannot be missing or null"",""status"":""error"",""correlationId"":""a6d49444-8375-4522-ae6e-3acd439b8240"",""requestId"":""23e9f4cb3e42a57bb64a14e0fa95181e""}

 

Sending to:

https://api.hubapi.com/contacts/v1/contact/?hapikey=[my hapikey]

 

JSON sent:

{""properties"":[

{""VALUE"":""Travel/Contract"",""NAME"":""PRN/Travel""},

{""VALUE"":""Aaron"",""NAME"":""First name""},

{""VALUE"":""Med/Surg"",""NAME"":""Specialty""},

{""VALUE"":""NewPDOrder.1@0822140419PM.com"",""NAME"":""Email""},

{""VALUE"":606,""NAME"":""Temp ID""},{""VALUE"":""Active"",""NAME"":""Status""},

{""VALUE"":""1984-8-22"",""NAME"":""Date of birth""},

{""VALUE"":""TX"",""NAME"":""State/Region""},{""VALUE"":75001,""NAME"":""Postal code""},{""VALUE"":""JasonTest"",""NAME"":""Region""},

{""VALUE"":""Aaby"",""NAME"":""Last name""},

{""VALUE"":""Addison"",""NAME"":""City""},

{""VALUE"":""RN"",""NAME"":""Certfication""}

]}

 

 

 

0 Upvotes
4 Replies 4
WendyGoh
HubSpot Employee
HubSpot Employee

Insert Contact Via API Generates Nondescript Error

Hey @gsconover,

 

It looks like the POST body that you're sending on the Create a new contact endpoint, doesn't match with the supported format e.g.

 

{
  "properties": [
    {
      "property": "email",
      "value": "testingapis@hubspot.com"
    },
    {
      "property": "firstname",
      "value": "Adrian"
    },
    {
      "property": "lastname",
      "value": "Mott"
    },
    {
      "property": "website",
      "value": "http://hubspot.com"
    },
    {
      "property": "company",
      "value": "HubSpot"
    },
    {
      "property": "phone",
      "value": "555-122-2323"
    },
    {
      "property": "address",
      "value": "25 First Street"
    },
    {
      "property": "city",
      "value": "Cambridge"
    },
    {
      "property": "state",
      "value": "MA"
    },
    {
      "property": "zip",
      "value": "02139"
    }
  ]
}

You'd need to change NAME to property and VALUE to value. 

 

Additionally, it also looks like you're using double ", could you change it to a single " and see if it works?

0 Upvotes
gsconover
Member

Insert Contact Via API Generates Nondescript Error

I had property:value pairs before, but that gave me the same error message. I saw in another post that was similar that someone tried name:value and it seemed to work.

 

The double-quotes shouldn't be the issue. The JSON that's generated seems to contain double quotes by default. We have a client using this integration for the last several years and they haven't had problems with the double-quotes. The only difference is, this new client who wants to integrate with HubSpot wants to insert contacts, whereas the other only updated.

 

Why can't the error indicate exactly which property is the problem?

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

Insert Contact Via API Generates Nondescript Error

Hey @gsconover,

 

I wouldn't expect it to work since it's not following our documented format. Could you share with me the post that you chanced upon? 

 

For now, our error doesn't point to the specific property and in this case, could you share with me your current POST body? I'd be happy to dig into this for you.

0 Upvotes
gsconover
Member

Insert Contact Via API Generates Nondescript Error

The post that mentioned switching "property" to "name" can be found at:

https://community.hubspot.com/t5/APIs-Integrations/Can-t-add-new-contacts-quot-property-cannot-be-mi...

 

In particular, reference the post from Feb 28, 2019 8:32 AM by user "koseto".

 

Seems like your error trapping needs to provide more details to your logs. Hard to imagine that a check against properties can't identify a property that fails. Either seems like an oversight or lazy coding.

0 Upvotes