Hi,
I am trying to set up an API using a prviate app. I am using post to the below with teh bearer in the header as well as the content type. It works and I can update a signe field and use get, but i get an error when tying to import multiple fields. I am using the sample on this page.
I am pointing here.
https://api.hubapi.com/crm/v3/objects/contacts
and using the Json from this page
https://legacydocs.hubspot.com/docs/methods/contacts/create_contact
It works for one field, eg email or name, but I get the error below once the properties part at the beginning is added.
{
"status": "error",
"message": "Invalid input JSON on line 2, column 17: Cannot deserialize value of type \`java.util.LinkedHashMap<java.lang.String,java.lang.String>\` from Array value (token \`JsonToken.START\_ARRAY\`)",
"correlationId": "9757e25e-c27c-4bf2-8f43-35f089a67ffd"
}
Am I doing something silly here, or do I need to change something around the properties part? I changed it to values, and it created a contact, but all the fields were blank. Any pointers are appreciated.
{
"properties": [
That endpoint will only create a single contact and return that contact. Try using the batch method to create multiple contacts. /crm/v3/objects/contacts/batch/create https://developers.hubspot.com/docs/api/crm/contacts
For update use /crm/v3/objects/contacts/batch/update
@dsmarion thank you for helping with this. I am trying to set up a form api so it will only be one contact at a time. I can get it to work for one field, but when I try for multiple fields i get the above error. It seems to be the square bracket part that cuases it. Here is the json I am testing with for the body.
{
"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"
}
]
}
Try doing it like this like it shows in the docs:
Also you can try the call right from the docs page if you want which can help troubleshoot any code issues.
@dsmarion thank you for this. apologies for more question, where can i caccess the pagesyou show above?
@dsmarion thank you so much! really appreciated your help here. It now works in postman using this format in the body.
{
"properties": {
"email": "example@hubspot.com",
"firstname": "Jane",
"lastname": "Doe",
"phone": "(555) 555-5555",
"company": "HubSpot",
"website": "hubspot.com",
"lifecyclestage": "marketingqualifiedlead"
}
}
@dsmarion thank you for helping with this. I am trying to set up a form api so it will only be one contact at a time. I can get it to work for one field, but when I try for multiple fields i get the above error. It seems to be the square bracket part that cuases it. Here is the json I am testing with for the body.
{ “properties”: [ { “property”: “email”, “value”: “testingapis@hubspot.com” }, { “property”: “firstname”, “value”: “Adrian” },
@dsmarion
Thank you for helping with this. I am trying to set up a form API to send one lead at a time. I can get the APi to work for just one contact field, but when I try to add multiple fields for one contact I get the error message above.
I am using this json in the body for testing. It looks like it is the [ bracket causing the error.
{
“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"
}
]
}