,

HubSpot Forms (REST) API checkbox values

HubSpot

HubSpot doesn’t adequately explain how to pass in boolean values through its Forms API. I recently had to work with this API and wrote down some hints. Hubspot Checkbox Field API

> curl –request POST -H “Content-Type: application/x-www-form-urlencoded” –data “[email protected]&firstname=John&lastname=Doe&company=ACME&phone=1112223333&message=blah&opt_in=true” “https://forms.hubspot.com/uploads/form/v2/123456/b7a12320e-ea5b-1234-4321-331623610e61”
The important bit here is that fields of type “Single On/Off Checkbox” require the text “true” or “false” despite being rendered as “Yes” or “No” in Hubspot. In C#, it’s important, when formatting text, to pass in string values instead of relying on string format processing within .NET to convert your boolean correctly.  It’s also important you’re passing in data with the Content Type set to “application/x-www-form-urlencoded” or it may misinterpret the values being passed in (or reject the request).

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This