APIs & Integrations

Not applicable

Form API only allows subnetwork IPs

Hi!

I’m trying to store user IPs with the Form API from server side. I’ve been able to do it, sending hs_context with ipAddress attribute, and contact gets updated… but only if ipAddress belongs to my server network. I’d like to send user IP, which I know, but as soon as I use his IP, the submission won’t change user IP (even though form submission is registered).

As contact ipaddress is read-only, I assume that hs_context.ipAddress should allow random IPs to be assigned to users.

Regards,

8 Replies 8
jmichaelTest
Member

Form API only allows subnetwork IPs

Did you find a solution to this problem? I too am facing this same issue with client Ip Address not getting updated.

I noticed that it uses my ISP router IP and not the IP address I am passing in the hscontext

0 Upvotes
Not applicable

Form API only allows subnetwork IPs

I’ve sent a couple of private messages. The exact curl request works once and stops working soon. It makes testing impossible, I can’t understand what’s going on here.

0 Upvotes
Not applicable

Form API only allows subnetwork IPs

Much appreciated, thank you

0 Upvotes
Not applicable

Form API only allows subnetwork IPs

I can’t understand what’s going on here. I’ve resumed this task today. After reading your comment I run the curl command that didn’t work previously, and it did work (10/13/2016 3:04 PM). Since then I’ve been struggling to replicate the exact encoding from Ruby without success. Just before giving up, I retried the exact command that worked today and it didn’t work. Could we move this discussion to private Hubspot support so I can give you the exact data for you to check it, please?

PS: in this context, “works” means “form submission was received and contact IP was updated”, and “won’t work” means “although form submission was received, contact IP was not updated”.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Form API only allows subnetwork IPs

I’ll message you directly.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Form API only allows subnetwork IPs

Hi @juanignaciosl

The ipAddress in hs_context should accept any IP address, and in fact we wouldn’t have a way to limit it to specific domains for a portal.

Do you have an example of the POST data you’re using? If there’s a problem with the ipAddress in the submission data, we grab the IP of the system making the request, so if you’re always seeing your server IP then it’s likely that there’s a formatting issue with the data.

0 Upvotes
Not applicable

Form API only allows subnetwork IPs

Sure. I’ve reproduced the problem with plain cURL. These next submissions are registered as form submissions, but only the first one actually changes the form. I’ve slightly changed the first, working IP, the form and the repo ids, but I’ve kept the IP that doesn’t work:

curl -X POST -d "email=juanignaciosl10@gmail.com&hs_context={\"ipAddress\":\"162.242.9.10\"}" https://forms.hubspot.com/uploads/form/v2/474275/e6714ea6-5a62-4370-8e3d-ed96ea8ff07c

curl -X POST -d "email=juanignaciosl10@gmail.com&hs_context={\"ipAddress\":\"2.137.212.94\"}" https://forms.hubspot.com/uploads/form/v2/474275/e6714ea6-5a62-4370-8e3d-ed96ea8ff07c

If you need the actual requests please write to me.

Thanks!

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

Form API only allows subnetwork IPs

The value of the hs_context field needs to be URL encoded, and cURL may not be handling that automatically.

curl -X POST -d "email=juanignaciosl10@gmail.com&hs_context=%7B%22ipAddress%22%3A%22162.242.9.10%22%7D" https://forms.hubspot.com/uploads/form/v2/474275/e6714ea6-5a62-4370-8e3d-ed96ea8ff07c
0 Upvotes