Hi there,
Currently having an issue that I can’t figure out when trying to submit a form via API.
The error I’m getting is:
{"status":"error","message":"Invalid input JSON on line 1, column 360: Cannot build FormSubmissionValue, some of required attributes are not set [value]","correlationId":"13c95bdd-831a-4131-91c8-0b8dcfa4e552"}
I have a console.log() to confirm that the object values are printing appropriately, which they are. My request, as far as I can tell, follows the requirements found in the docs:
let data = {
"fields": [
{
"name": "company",
"value": contact.company,
},
{
"name": "firstname",
"value": contact.firstname,
},
{
"name": "lastname",
"value": contact.lastname,
},
{
"name": "email",
"value": contact.email,
},
{
"name": "phone",
"value": contact.phone,
},
{
"name": "purchase_order_number",
"value": contact.purchase_order_number,
},
{
"name": "notes_",
"value": contact.notes_,
},
{
"name": "repair_return_address_line_1_",
"value": contact.repair_return_address_line_1,
},
{
"name": "city",
"value": contact.city,
},
{
"name": "state",
"value": contact.state,
},
{
"name": "zip",
"value": contact.zip,
},
{
"name": "country",
"value": contact.country,
},
{
"name": "check_this_box_for_expedited_service_fees_apply_see_below_",
"value": contact.check_this_box_for_expedited_service_fees_apply_see_below_,
},
{
"name": "contact_typefinal",
"value": "Provider",
},
{
"name": "serial_number_2",
"value": firstObj.serial_number,
},
{
"name": "subject",
"value": contact.company,
},
{
"name": "part_number",
"value": firstObj.part_number,
},
{
"name": "initial_repair_reason_",
"value": firstObj.initial_repair_reason,
},
{
"name": "content",
"value": firstObj.subject,
}
],"legalConsentOptions":{
"consent":{
"consentToProcess":true,
"text":"I agree to allow blank to store and process my personal data.",
"communications":[
{
"value":true,
"subscriptionTypeId":999,
"text":"I agree to receive marketing communications from Example Company."
}
]
}
}
}
var finalData = JSON.stringify(data)
var options = {
method: 'POST',
url: 'https://api.hsforms.com/submissions/v3/integration/submit/OMITTED/4e1e28f2-0844-4d58-a5f1-499a46e699f9',
headers: {'content-type': 'application/json'},
body: finalData
};
console.log(options)
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});