Questions:
What is the URL for posting this data?
Where do I find the Portal ID?
Where do I find the Form ID?
What is the proper payload structure of sending data?
Do I need to make my request a query string on the URL?
Most importantly, can someone show an example of vanilla JS version of posting to Form API with CORS? Data et all please
This is noted in the documentation: https://api.hsforms.com/submissions/v3/integration/submit/:portalId/:formGuid
Where do I find the portal ID?
This is your HubSpot account ID and can also be found in any app URL while you are logged in. For example, in https://app.hubspot.com/reports-dashboard/1234567/marketing, 1234567 is the portal ID.
Where do I find the form ID?
Via the Get all forms endpoint or in the URL when viewing any form in your portal.
What is the proper payload structure of sending data?
As documented, the payload should be formatted in JSON. All form fields should be transmitted as objects within the "fields" array.
Do I need to make my request a query string on the URL?
No. As documented, the submission information is contained in the body.
There's plenty of documentation out there on submitting form data with AJAX. For example, see this Stack Overflow discussion.
You can ensure that your field data is formatted correctly by following guides like this.
This is noted in the documentation: https://api.hsforms.com/submissions/v3/integration/submit/:portalId/:formGuid
Where do I find the portal ID?
This is your HubSpot account ID and can also be found in any app URL while you are logged in. For example, in https://app.hubspot.com/reports-dashboard/1234567/marketing, 1234567 is the portal ID.
Where do I find the form ID?
Via the Get all forms endpoint or in the URL when viewing any form in your portal.
What is the proper payload structure of sending data?
As documented, the payload should be formatted in JSON. All form fields should be transmitted as objects within the "fields" array.
Do I need to make my request a query string on the URL?
No. As documented, the submission information is contained in the body.
There's plenty of documentation out there on submitting form data with AJAX. For example, see this Stack Overflow discussion.
You can ensure that your field data is formatted correctly by following guides like this.