rest-compatible methods
Following methods can be used:
get
post
put
delete
head
options
trace
patch
All methods are transcript for an actual call. For example, pfx-rest:get
will eventually call GET https://test.me/...
Properties
Option | Type | Since Version | Default | Description |
---|---|---|---|---|
| string |  |  | URI to fetch data from. If the parameter If the parameter If there are parameters needed in URI, each parameter should be placed as a placeholder |
| integer | Â | 20000 | Connection timeout in milliseconds. Used both for authentication and fetch. |
| integer | Â | 0 | Defines maximum size of a response in MB. After reaching the limit, an exception will be thrown. If the default value (0) is set, the response size is not checked. |
| string |  | application/json | Content type of the fetch request. The value has to follow the HTTP standard. |
| string | Â | 200-299 | Status codes which are considered a success response. The values are inclusive. Multiple ranges can be defined, separated by a comma, e.g. 200-204,209,301-304. Each range must be a single number or from-to with the dash included. |
| string | Â | Â | Proxy address to use. |
| integer | Â | Â | Proxy port to use. |
| string | Â | Â | Name of an existing connection which will be used to access the resource. |
| Boolean | Â | true | Indicates that encoded data (gzip, deflate, ...) should be automatically decoded. |
| Boolean | Â | false | Determines whether to fail if a connection is missing or whether to use the default connection. |
| Boolean | Â | false | If set to true, the content is streamed directly to a file. Otherwise the content is stored to the memory. File location can be set using the |
| string | Â | file | If a multipart file is uploaded, specifies a key of the file. |
| Boolean |  | true | If a multipart file is uploaded, determines whether to use boundary in the request body and content type. |
| string | 4.7.0 | Â | Defines input source for data in exchange. It can be stored in the header, property or body. |
| string | 4.7.0 | Â | Defines input source name for the source type header and property. Put here the name of the exchange header or exchange property. |
| string | 4.7.0 | Â | Defines output target for data in exchange. It can be stored in the header, property or body. |
| string | 4.7.0 | Â | Defines output target name for the target type header and property. Put here the name of the exchange header or exchange property. |
| string | 4.9.0 | Â | If |
Unknown Properties
Unknown properties are handled as query parameters. For details see the section below.
An exception is when using the method pfx-rest:system – in this case, unknown properties are handled as properties.
Input Source / Output Target
A standard way to put data to a component or retrieve them from a component is using body. However, in certain cases it is not the best option. Hence the inputSource
, inputSourceName
, outputTarget
and outputTargetName
properties were created to tackle the problem.
An example how to define a component that fetches data from the header header1
:
<to uri="pfx-rest:post?uri=http://localhost:8080/api/ad/data&inputSource=header&inputSourcenName=header1"/>
Example how to populate data from the body:
<setBody>
<constant>body123</constant>
</setBody>
<to uri="pfx-rest:post?uri=http://localhost:8080/api/ad/data"/>
Body is default option. You can also set inputSource=body
, the effect would be the same.
Example how to send results to the property prop1:
<to uri="pfx-rest:post?uri=http://localhost:8080/api/ad/data&outputTarget=property&outputTargetName=prop1"/>
The toD Problem
The toD
option might seem more dynamic:
However, this option has a caveat described here. In short, using toD
interpolates the parameters, so the result component is:
When you change the data in the header MyCustomMap
to data2
, this component would be created:
So if the parameter has variable content (let’s say n
), there would be n
components and endpoints created, which would negatively affect performance.
In this case, if you use static parameters with <to....inputSource=header&inputSourceName=head1
, only one component and one endpoint would be created for all possible values, offering top performance.
Handling ZIP Response
If an endpoint returns a ZIP response (content-type=application/zip
) and the disableStreamCache
option is set to false
, then the response will be stored into memory as a Base64 encoded string. This allows you to work with the ZIP file in a route.
Examples
Call with payload from header
Request body: {"somedata":"exactly as endpoint expects"}
Â
Call with result stored in header
Result data will be stored in the header myHeader
.
Â
Call with result stored to property
Result data will be stored to the property named myProp
.
IntegrationManager version 5.8.0