What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to get submission data form WebHooks of JotForm using java apps

    Asked by viksonaisingh on January 09, 2015 at 10:19 PM

    Hi,

    I have a form called "apply now" this is the url  "http://form.jotform.me/form/43496529286469" . With this form I have integrated webhooks with this url "http://requestb.in/10pic6e1?inspect". I able to get the data when I am using httpConnecting and passing this url.

     

    But the problem is response is not as I expect, result giving me various information like as showed in .pjg attached. I want only form submitted data.

     

    Is there any way to get submitted data of form using webhooks and get those submitted data from webhooks to my java apps.

     

    Please replay as soon as possible. Its urgent.

     

    Thanks

    Vikash Singh

     

    Page URL:
    http://form.jotform.me/form/43496529286469

    Screenshot
    JotForm submission data apps problem integrated java
  • Profile Image

    Answered by Ben on January 10, 2015 at 04:47 PM

    Hi Vikash,

    Did you declare the JSON object in your java code that would parse the JSON string sent by the webhook?

    Once you do so you should have data shown in a manner that is much easier to use.

    Best Regards,
    Ben

  • Profile Image

    Answered by viksonaisingh on January 10, 2015 at 09:00 PM

    Thanks for Reply,can you send me some sample or idea how to do Like this.

    I already tried with Json Object but Result was same

     

     

  • Profile Image

    Answered by Ben on January 10, 2015 at 09:55 PM

    Hi Vikash,

    Unfortunately I have a somewhat basic understanding of Java code as I did not have too much chances to work on it.

    Now, I presume that you would first need to remove the backslashes on the code - not sure what you do already.

    String newStr = receivedData.replace("\\", "");

    Following this to do next:

    JSONObject myJson = new JSONObject(newStr);

    this should allow you to access the "q10_firstName" with the value of "sanat" (based on the request bin).

    Although based on it you might not need the replace (to strip the backslashes).

    Would you please paste the entire code that you already have into some service such as pastebin.com? This should help us to see more what might be the issue.

    Best Regards,
    Ben

  • Profile Image

    Answered by viksonaisingh on January 10, 2015 at 10:03 PM

    Ok this is our PasteBin code

     

    http://pastiebin.com/54b06136e5050

     

    which is used as webhook URL

     

    I simply write Http connection in java using following code

    package controls;

    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;

    import com.google.gson.JsonObject;
    import com.google.gson.JsonParser;

    public class TestMain {
         public static void main(String[] args) throws Exception {
                URL oracle = new URL("http://requestb.in/10pic6e1?inspect");
                URLConnection yc = oracle.openConnection();
                BufferedReader in = new BufferedReader(new InputStreamReader(
                                            yc.getInputStream()));
               
               String inputLine;
                //JsonObject json = (JsonObject)new JsonParser().parse(in.readLine());
               // System.out.println(json);
               while ((inputLine = in.readLine()) != null)
                    System.out.println(inputLine);
    /*            System.out.println(json);
    */            in.close();
            }
         
    }

     

    but Response is quite un-pridictable

     

    can you help me on this

    Note

    --------

    can you give your skypeID so that i can share our screen and show you exact issues of our Code

     

    mySkype Id:  viksonai.singh

     

     

     

     

     

     

  • Profile Image

    Answered by viksonaisingh on January 10, 2015 at 10:37 PM

    what i already did

     

    1)Webhooks URL is http://pastiebin.com/54b06136e5050 where some php script writeen to send mail

    2)Go to From Integration->Other->webhook and paste the http://pastiebin.com/54b06136e5050 as webhook URLt the

    3)Submit the Form and a get the mail notification

     

    JotForm noreply@jotform.com via amazonses.com 
    Jan 10 (1 day ago)
       
    to me
     
      jotform.com  
     
    Question Answer
    First Name cdsdssdsds
    Last Name cxccxcxc
    Mobile Number 455-434-3223
    Email Address asdf@gmail.com
     
         
     

     

    so i want to confirm wheathet its coming from WebHook or somewhere else,,  I also debug with  http://requestb.in/134vn1u1

     

    Can you confirm this things Quickly

     

    Thanks

     

     

     

  • Profile Image
    JotForm Support

    Answered by jonathan on January 11, 2015 at 07:24 AM

    Hi,

    I suggest also reviewing the JotForm Webhook user guide -How-to-Setup-Webhook-with-JotForm

    I checked your PHP code from here http://pastiebin.com/54b06136e5050

    and I think the correction was provided by our colleague on this thread 

    http://www.jotform.com/answers/493615-WebHook-not-working-Incorrect-field-names

    You were using an incorrect form field names in your mail PHP code for this jotform http://www.jotform.me/form/43496529286469

     

    $body .= "FirstName: ". $obj['q10_firstName'];

    $body .= "n";

    $body .= "LastName: ". $obj['q11_lastName'];

    $body .= "n";

    $body .= "MobileNumber: ". $obj['q13_mobileNumber[full]'];

    $body .= "n";

    $body .= "EmailAddress: ". $obj['q12_emailAddress12'];

    $body .= "n";

     

    Can you try correcting them first and then test again.

    Hope this help. Please let us know if issue remains.

    Thanks.

     

     

     

     

  • Profile Image

    Answered by Ben on January 11, 2015 at 12:52 PM

    Hi Vikash,

    I wanted to add to the comment of my colleague that webhooks are used to get the data, not to pull it in.

    Looking at your code above:

    URL oracle = new URL("http://requestb.in/10pic6e1?inspect");

    You are requesting the data and not directly from the jotform, but from the requestb.in website - which downloads the entire web page and would not work with json parser, since it is a HTML not a JSON string.

    If you take a look at the guide: How to Setup Webhook with JotForm

    In your webhook URL, you are sending the data to that specific location, where code should not be trying to pull it in, but to accept it. This should be the url to your java applet.

    I hope this makes sense.

    Besides this, the code seems to be OK in regards to parsing. I see that you are using Google gson for json parsing, which should not be the one causing the issues.

    Best Regards,
    Ben