Issue in submitting form via V3 api

forms

#1

I was using submit form to add new contact to my hubspot contacts using javascript code and i was getting error as

Blockquote

{"status":"error","message":"Invalid input JSON on line 1, column 33: Cannot build FormSubmissionValue, some of required attributes are not set [name, value]","correlationId":"4e91576b-fc91-4444-8637-275946ad37ad","requestId":"257d66998300805f1914cd28e4560c1f"}

Blockquote

this was my request body for post request
{"fields":[{"firstname":"rakesh"},{"lastname":"chauhan"},{"email":"rakesh376@gmail.com"},{"primary_industry_type":"Automotive"}]}


#3

Hi @rakesh.chauhan, it doesn't look like the way you're formatting your body is correct. The docs state your fields should be formatted like so:

"fields": [
    {
      "name": "email",
      "value": "example@example.com"
    },
    {
      "name": "lastname",
      "value": "Example Lastname"
    },
    {
      "name":"multiple_checkbox_property",
      "value":"option_1;option2"
    },
    {
      "name":"date_property",
      "value":1520985600000
    },
    {
      "name":"checkbox_property",
      "value":"true"
    }
  ]

From your example, you're missing the name property for each value you provide. I created a simple Repl here: https://repl.it/@cbarley10/DefensiveBeigeRuntimes in NodeJS for a Form Submission using the v3 API. I'd recommend emulating the example there if you can! Or please use the example in the sidebar.