HttpRequest Task
Last updated
Last updated
OpenEndpoints supports any kind of HTTP request to other systems. You can call and fetch data from
REST Api
SOAP interface
simple URL that returns content
Examples:
fetch data from any CRM or ERP system (as long as it offers a REST or SOAP API that can be called from the internet)
upload generated files to a CRM or an archive
fetch the next available invoice-number from your accounting system, generate an invoice and send it as an email
validate the existence of an address by calling an external validation service
This task performs an HTTP request, checks the response is a 2xx OK, and ignores the response body.
Redirects are not followed.
The attribute ignore-if-error="true" may be present on the <task> element to indicate that if an error occurs (e.g. server not found, non-2xx response, etc.) this error is ignored. By default, the error aborts the processing of the endpoint.
The request body is expressed as xml within the <xml-body> tag. Endpoint parameters are expanded.
Uploaded content encoded in base64 can be filled into any tag of the request body. This requires 2 actions:
Add attribute upload-files="true" to <xml-from-url>
Add to any element of your request body attributes upload-field-name="foo" encoding="base64"
The uploaded content will expand into that xml element.
base64 encoded content only
The expansion of uploaded content works for base 64 encoded content only!
It is also possible to send generated content within a request body:
Add attribute expand-transformations="true" to <xml-from-url>
Add to any element of your request body attributes xslt-transformation="foo" encoding="base64"
iAdding that attribute to the element indicates that the transformation with that name should be executed (for example, generate a PDF file), and the contents of the resulting file should be placed in this tag. The encoding is always base64, no other encodings are supported.
The request body is generated by XSLT. This leaves maximum flexibility to build different content of the request body depending on endpoint parameter values!
Note that this is a transformation within a transformation. The XSLT takes a <parameters> as its input document; This XSLT does not have access to the results of any other data sources. The reason is, that data sources cannot use data produced by another data source.
The XSLT file is taken from the http-xslt directory.
The transformation-input to apply that XSLT has <parameters> as its root tag.
The optional attribute upload-files="true" and expand-transformations="true" may be present as above.
The request body is expressed as json within the <json-body> tag. Endpoint parameters are expanded.
Endpoint parameters are expanded within the string context of JSON, that is to say that no concern about escaping is necessary.
Options for expanding base 64 content from file upload or generated content is not available for JSON.
The request body is generated by XSLT. That requires that the result of the transformation is valid JSON.
Note that this is a transformation within a transformation. The XSLT takes a <parameters> as its input document; This XSLT does not have access to the results of any other data sources. The reason is, that data sources cannot use data produced by another data source.
The XSLT file is taken from the http-xslt directory.
The transformation-input to apply that XSLT has <parameters> as its root tag.
Options for expanding base 64 content from file upload or generated content is not available for JSON.
The beauty of <OpenEndpoints/> shows in the solution of the optional request body, which can be json or xml. There are several different options how-to build the content for the request-body.