Create Contact Batch

Hi all,

I am using the API to communicate batches of contacts using the endpoint

/contacts/v1/contact/batch/

I get an error message response which reads:

{“status”:“error”, “message”:“Invalid input JSON on line 1, column 1: Can not deserialize instance of java.util.ArrayList out of VALUE_STRING token”,“correlationId”:“3c1488a8-24f5-4e1c-b506-18edcd870065”,“requestId”:“a85c3ea88b60a7d0e3cfe5736c819b11”}

The JSON i am sending is valid. I’ve checked and double checked.

Please help :disappointed_face:

My output is below:

[
 {
 "email": "twst@email.com",
 "properties": [
 {
 "property": "company",
 "value": "Test"
 },
 {
 "property": "website",
 "value": "www.test.com"
 },
 {
 "property": "firstname",
 "value": "Carl"
 },
 {
 "property": "lastname",
 "value": "Swann"
 },
 {
 "property": "jobtitle",
 "value": "Dr"
 },
 {
 "property": "phone",
 "value": "0789654321"
 },
 {
 "property": "product",
 "value": "Khaos Control Hybrid"
 },
 {
 "property": "eventList_2019",
 "value": "Spring Fair"
 }
 ]
 },
 {
 "email": "email@yes
.com",
 "properties": [
 {
 "property": "company",
 "value": "Another one"
 },
 {
 "property": "website",
 "value": "www.a.ither.com"
 },
 {
 "property": "firstname",
 "value": "Anither"
 },
 {
 "property": "lastname",
 "value": "One"
 },
 {
 "property": "jobtitle",
 "value": "Com"
 },
 {
 "property": "phone",
 "value": "0789675341"
 },
 {
 "property": "product",
 "value": "Khaos Control Hybrid"
 },
 {
 "property": "eventList_2019",
 "value": "Spring Fair"
 }
 ]
 },
 {
 "email": "keeley@sophieallport.com",
 "properties": [
 {
 "property": "company",
 "value": "Sophie Allport"
 },
 {
 "property": "website",
 "value": "www.sophieallport.com"
 },
 {
 "property": "firstname",
 "value": "Keeley"
 },
 {
 "property": "lastname",

 "value": "Walters"
 },
 {
 "property": "jobtitle",
 "value": "Accounts "
 },
 {
 "property": "phone",
 "value": "01778235648"
 },
 {
 "property": "product",
 "value": "Khaos Control Hybrid"
 },
 {
 "property": "eventList_2019",
 "value": "Spring Fair"
 }
 ]
 }
]

Hi @Cygnus , have you tried out a one off request in Postman to check if it’s an issue with how you’re environment is configured? I just made a request via Postman with your exact JSON payload and contacts were created successfully in my account.

Looking up the error it seems like this appears when you try to deserialize an object into a list. You need it to be a JSON array

Hi @cbarley,

Thank you so much for taking the time to assit me here. I havent heard of Postman before so I’ll look it up and perform the test you recommend.

Your suggestion of deserializing an array: Do i have control over this? I understand that i am serializing my data into a json object and sending it to HubSpot. Is it not HS platform who are responsible for deserializing into the correct object their end?

Apologies, I am quite confused trying to get my head around all of this.

Thanks again.

@Cygnus , I’m not sure about the deserialization error, it was just a suggestion. To me, it basically just sounds like the format you’re sending to hubspot is not a format we recognize and we cannot parse the information you’ve given us.

Postman is a REST client, but any other rest client should work too

@cbarleyThank you for your time again. You were correct, it was the way I was passing the information to HS.

I was using an additional parameter in my serialization function:

object json = JsonConvert.SerializeObject(_hsProspectList,

Formatting.Indented

);

After removing this, it worked fine!

Thank you again for your assistance..

Swann