APIs & Integrations

bigfish
Member

Submit data to form API not working

Am trying to set up Submit data to form API and have got this far but not working:

Hubspot Link Code:


@hubspot_url = ‘forms.hubspot.com
@hubspot_path = '/uploads/form/v2/:portal ID/:Form GUID
hubspot_fields = {
:IPAddress => request.remote_ip,
:UserToken => cookies[:hubspotutk],
:FirstName => isa_registration.forenames,
:LastName => isa_registration.surname,
:Email => isa_registration.email,
:Company => isa_registration.place_of_work,
:Country => country,
:Phone => isa_registration.phone_number,
:Salutation => isa_registration.title,
:JobTitle => isa_registration.job_title,
:State => us_state,
:WhereHeard => isa_registration.where_heard
}
http = Net::HTTP.new(@hubspot_url)
res = http.post(@hubspot_path, hubspot_fields.to_param)

we have the correct url with portal ID and GUID ID get http 400 error , problem accessing /uploads/form/…, http get is not supported by this url.

any assistance would be appreciated

0 Upvotes
1 Reply 1
Dadams
HubSpot Employee
HubSpot Employee

Submit data to form API not working

@bigfish You’ll need to submit the data using https, otherwise if you’re POSTing to http://forms.hubspot.com... you’ll get a 307 response, and in this case it looks like the redirect URL is being followed but it’s making a GET request instead of making another POST request. If you make the initial POST using https://forms.hubspot.com... you shouldn’t see that error.

0 Upvotes