Unable to capture form fields with Webhook using JAVA

  • Profile Image
    rakeshranjan01
    Asked on December 13, 2015 at 02:05 AM

    @POST

    @Path("/regdoc")

    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)

    @Produces(MediaType.TEXT_PLAIN)

    public String registerDoctor( @Context HttpServletRequest request, @FormParam("mobileNumber") String mobileNumber)

    {

    logger.info("Regdoc invoked, Mob Num= "+mobileNumber); return mobileNumber; }

     

    Hello

    We are having a Java REST API in the backend to capture form submissions. However we are unable to capture form fields (mobileNumber as test field). Need help

    Cheers

    Rakesh Ranjan

  • Profile Image
    Mike
    Answered on December 13, 2015 at 07:52 AM

    Thank you for contacting us.

    Since you use a webhook instead of standard HTTP Post thank you redirect, the field names may be different. You can try to debug the webhook wth a http://requestb.in/ service. It looks like that the field name should be q15_mobileNumber in your case.

    Send Post Data is not required for our webhooks so you may consider switching it from Yes to No.

    If you need any further assistance, please let us know.

  • Profile Image
    rakeshranjan01
    Answered on December 14, 2015 at 01:59 AM

    Hello

    Thanks for sharing with me the instructions however I am still not able to fetch form field data in the REST service. Below is the code of REST webservice which does get invoked but is unable to fetch form data fields

    @POST

    @Path("/regdoc")

    @Consumes(MediaType.MULTIPART_FORM_DATA) 

    @Produces(MediaType.TEXT_PLAIN)

    public String registerDoctor(@Context HttpServletRequest request,

    @FormParam("q15_mobileNumber") String mobileNumber)

    {

    logger.info("Regdoc invoked, Mob Num= "+mobileNumber);

    return null;

    }

     

    Value of mobile number still remains null. I am not sure if I missing something.

     

    Cheers

    Rakesh

  • Profile Image
    Mike
    Answered on December 14, 2015 at 09:29 AM

    Sorry, but I am not a programmer to debug your code. You may consider sending an email to api@jotform.com to see if some of our developers can take a look into this.

    We also have some webhook code samples in PHP which can be found on the following article, so you can check them out to get the general idea.

    Webhook Samples

    Thank you.