Form Post Server Side


#1

Trying to post form details server side, though the data is getting posted and not returning any error, however the contact entry is not reflecting in the Hubspot UI

Server side script I am posting:
note: I have shown details of HubId, GUID, phone number to "xxx" in below script:

try {
String urlString = "https://forms.hubspot.com/uploads/form/v2/xxx/xxx";
StringBuffer params = new StringBuffer();
params.append("firstname=sachin");
params.append("&lastname=singh");
params.append("&email=javed.kazi@gmail.com");
params.append("&phone=xxx");
params.append("&company=xxx");
params.append("&hs_context=hjhfjh");
URL u;
try {
u = new URL(urlString+params.toString());
HttpURLConnection con = (HttpURLConnection) u.openConnection();
con.setRequestMethod("GET");
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
} catch (MalformedURLException e) {
e.getMessage();
}


#2

referring page - https://developers.hubspot.com/docs/methods/forms/submit_form


#3

Please help, thanks in advance.


#4

Hi @Sachin,

Can you try logging the raw request body, before you try sending it to HubSpot, so that I can take a closer look? Also, can you send me a link to the form in HubSpot?