Configure an Adaptive Form for REST Endpoint submit action

Use the Submit to REST Endpoint action to post the submitted data to a REST URL. The URL can be of an internal (the server on which the form is rendered) or an external server.

AEM as a Cloud Service offers various out of the box submit actions for handling form submissions. You can learn more about these options in the Adaptive Form Submit Action article.

Advantages

Some of the advantages of configuring the Submit to REST endpoint submit action for Adaptive Forms are:

  • It enables seamless integration of form data with external systems and services through RESTful APIs.
  • It provides flexibility in handling data submissions from Adaptive Forms, supporting dynamic and complex data structures.
  • It supports dynamic mapping of form fields to parameters in the REST endpoint URL, allowing for adaptable and customizable data submissions.

Configure Submit to REST Endpoint submit action steps-to-configure-submit-to-restendpoint-submit-action

To configure submit action:

  1. Open the Content browser, and select the Guide Container component of your Adaptive Form.

  2. Click the Guide Container properties Guide properties icon. The Adaptive Form Container dialog box opens.

  3. Click the Submission tab.

  4. From the Submit Action drop-down list, select Submit to Rest endpoint.
    Action configuration of Submit to Rest endpoint

    To post data to an internal server, provide path of the resource. The data is posted the path of the resource. For example, /content/restEndPoint. For such post requests, the authentication information of the submit request is used.

    To post data to an external server, provide a URL. The format of the URL is https://host:port/path_to_rest_end_point. Ensure that you configure the path to handle the POST request anonymously.

    Mapping for field values passed as Thank You Page parameters

    In the example above, user entered information in textbox is captured using parameter param1. Syntax to post data captured using param1 is:

    String data=request.getParameter("param1");

    Similarly, parameters that you use for posting XML data and attachments are dataXml and attachments.

    For example, you use these two parameters in your script to parse data to a rest end point. You use the following syntax to store and parse the data:

    String data=request.getParameter("dataXml");
    String att=request.getParameter("attachments");

    In this example, data stores the XML data, and att stores attachment data.

    The Submit to REST endpoint Submit Action submits the data filled in the form to a configured confirmation page as part of the HTTP GET request. You can add the name of the field to request. The format of the request is:

    {fieldName}={request parameter name}

    As shown in the image below, param1 and param2 are passed as parameters with values copied from the textbox and numericbox fields for the next action.

    Configuring Rest Endpoint Submit Action

    You can also Enable POST request and provide a URL to post the request. To submit data to the AEM server hosting the form, use a relative path corresponding to the root path of the AEM server. For example, /content/forms/af/SampleForm.html. To submit data to any other server, use absolute path.

  5. Click Done.

Best Practices

  • When posting data to an external server, make sure the URL is secure, and configure the path to handle the POST request anonymously to protect sensitive information.
  • To pass the fields as parameters in a REST URL, all the fields must have different element names, even if the fields are placed on different panels.
recommendation-more-help
fbcff2a9-b6fe-4574-b04a-21e75df764ab