API field names don't correspond to Form UI field names
I'm using the form API to submit from my javascript client to my forms in hubspot. Some of the fields are ok: I am able to tell what name they should be from the name in the form UI. But most of them, and especially any non standard one such as "date of birth", don't work. I tried data_of_birth, dateofBirth, dateOfBirth, DateOfBirth, date_of_birth_property...nothing works. Worse yet, the API docs do not cover this. It only says "it follows the same format as the Contacts API". But when you look at the Contacts API, it doesn't use the fields: {} field it uses properties: {}. And still doesn't dicuss the format. This is a crucial piece of info to use the API. https://developers.hubspot.com/docs/methods/forms/submit_form_v3
No matter what I put in the request, I always get something like:
{
"status": "error",
"message": "The request is not valid",
"correlationId": "6df6de0c-ee28-4934-b585-208650f06619",
"errors": [
{
"message": "Error in 'fields.dateofbirth'. Field 'dateofbirth' isn't in form definition",
"errorType": "FIELD_NOT_IN_FORM_DEFINITION"
}
],
"requestId": "858912a1da6908f18b68e0e5c8f5cd8a"
}
Before, forms didn't require to add Fields (=properties) to them. If the fields were valid, the forms worked. We had a form with no Fields in it, except for the email, so we had complete flexibility in the dev side. It worked. After the change, for forms created from March 22 and onwards, you need to include all relevant fields explicitly in the form.
Forms older than March 22 should still work with the previous behavior, this is what Hubspot say.
But for some reason, it won't work with newer fields created after March 22, even if the form is older. It's like what they said about the granularity is wrong - it's about the date of the fields that are used in the form, not the the date of the form itself.
We added the Field to the old Form (marked it as not required) and it worked. All older Fields that were submitted via the Form without being added, still work. Weird.
API field names don't correspond to Form UI field names
Hi,
Going from the error message, it seems like the wrong internal name for the field might have been used here. A great way to check into this is to head over to your property settings in HS, find this property and check the 'Internal name'. I hope that helps!