Request From Web Form
A simple web form to send data to OpenEndpoints could look like this:
What shall happen after submit?
The form calls your endpoint, which might for example
use an Email Task to forward an email to your back office, and also send a custom message to the email-address submitted with the form.
use an HttpRequest Task to send data to your CRM.
The behaviour of your web form after pressing the submit button depends on both the actions defined in your endpoint (success and error actions), and the html code in your web form.
Option 1: Redirect to Success-Page / Error-Page
Configure your endpoint to redirect the request to a success or error page - see Endpoint to Redirect Request. Note that the absolute path to your page must be used, not a relative path.
On success (but not on error) you may use parameter placeholders. For example, you could add tracking information that is executed by your success page.
Option 2: Return HTTP-Status
Omitting a particular action on success or failure will simply return a status code of 200 for success or 400 for any type of failure.
Option 3: Return Custom JSON
If you want to return a user-defined JSON, then use a data source transformation to create that JSON using XSLT. For example, the JSON could contain some ID returned from your CRM (see: Intermediate Values):
Use an Endpoint to Return XSLT Transformation:
To output JSON, the XSLT should use the output method "text":
The transformer should explicitly define the content type "application/json":
Option 4: Download Document
In case you use an Endpoint to Return XSLT Transformation having a download-filename
attribute, the user will stay on the form, while the document is downloaded:
Form Inputs vs Endpoint Parameters
The form entries are passed to the endpoint parameters. Depending on whether these parameters have a default value and whether a Parameter Transformation is used, different things must be observed:
Option 1: Endpoint With Parameter Transformation
The name attributes in the web form can be completely different from the names of the endpoint parameters.
The
parameter-transformation-xslt
may only output parameter values of parameters that are declared in theendpoints.xml
file. There are no restrictions as to how inputs from the web form are mapped with this output.The output generated by your XSLT requires values for any parameter not having a default value. Not doing so will raise an error.
Option 2: Endpoint Without Parameter Transformation
Input from the web form is passed to endpoint parameters only if the name attribute in the web form matches the name attribute of the endpoint parameter. Note that names are case sensitive.
Parameters without a default value must have an equivalent in the web form. Only parameters for which there is a default value are optional.
Inputs from web forms for which there is no corresponding parameter are silently ignored.
Potential Source of Error
OpenEndpoints parameter names are case sensitive. For example, if the name of the parameter is "firstname", then it will not match with "Firstname".
Last updated