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
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
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
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
Form Inputs vs Endpoint Parameters
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