Adapter - Http Request
This page describes version 2.0.12 of the adapter.
Overview
This adapter can be used to make a HTTP request. An adapter of type HTTP request can be configured in multiple configurations: specifying a default base address, query string and headers, or using it ad-hoc for multiple sites.
The available commands will make it possible to send five types of HTTP requests: POST, GET, PUT, PATCH and DELETE.
Header values for the HTTP message can be provided as properties named with the prefix header.. The prefix will be removed and the rest of the name is the header name.
For example, adding a property named header.Authorization will add a header named Authorization to the HTTP request.
Payload data for requests is sent using JSON. Properties whose names start with content. will be added to the payload. Also the full content can be specified at once by providing the content property of the command.
Nested properties and array properties are allowed in the payload data.
Properties
Name | Display | Is Required | Comments | Type | Default Value | Maximum Value | Minimum Value | Maximum Length | Minimum Length |
---|---|---|---|---|---|---|---|---|---|
baseUri | Base URI | False | The base uri. | string | 1024 | ||||
queryString | Query String | False | The query string will be appended to the URI. | string | 1024 | ||||
header1 | Header1 | False | Header that will be included in all requests made using this adapter. Use format HeaderName:HeaderValue. | string | 1024 | ||||
header2 | Header2 | False | Header that will be included in all requests made using this adapter. Use format HeaderName:HeaderValue. | string | 1024 | ||||
header3 | Header3 | False | Header that will be included in all requests made using this adapter. Use format HeaderName:HeaderValue. | string | 1024 |
Commands
Patch (patch)
Build and issue a new HTTP request, using the PATCH http verb. Content type is by default application-json but can be overwritten by setting header.Content-Type. Other headers can be set by adding command properties named header.Header-Name. Content can be provided using the format content.property (for json) or by setting content directly (for other content types). Currently the supported response content types are application/json, text/plain, text/html and all image types (image/*). If the response Content-Type is not supported, an error will be set in the response property content_error but the command itself will not be failed. The main reason why the command will fail, is an unsuccessful return status code.
Request Properties
Name | Display | Description | Is Required | Type |
---|---|---|---|---|
uri | URI | Specify the request URI. To override the base URI from the adapter settings page include a /. To append to the base URI do not use a / . | True | string |
header.* | Header | Each 'header.*' adds that header to the request. Replace * with the header name. Default headers specified on the adapter properties will be overwritten by headers from the command properties. | False | string |
content | Content | Overwrites other content.* properties. If content is specified, then this is the raw text content of the http request. | False | string |
contentbinary | Content Binary Data | Overwrites other content.* properties. If contentbinary is specified, then the provided base64 encoded text will be decoded and sent as a binary content. Make sure to also put in the correct content type for this request. | False | string |
content.* | Json Content | All properties specified on the content.* keys will be part of the json content of this request. | False | string |
forceJsonResponse | Force JSON Response | Force the response to be parsed as JSON regardless of the content type. | False | boolean |
basicauth.username | Basic authentication Username | Basic authentication username mandatory for the basic access authentication. | False | string |
basicauth.password | Basic authentication Password | Basic authentication user password mandatory for the basic access authentication. | False | string |
oauthtokenuri | OAuth Token URI | Token URI for OAuth2. If this value is provided, then a bearer token will be obtained and set on this request. | False | string |
oauthheader.* | OAuth Headers | Any custom headers required for the OAuth request can be specified the same way as the request properties, but prefixing them with 'oauthheader.*'. Headers specified in the adapter configuration will not be used on the OAuth request. | False | string |
oauth.grant_type | OAuth Grant Type | OAuth2 grant type used when getting the bearer token. Supported grants are 'client_credentials' and 'password'. If the token returned by the OAuth request is not of type 'bearer' then this command will fail. | False | string |
oauth.username | OAuth Username | OAuth2 username mandatory for the 'password' grant. | False | string |
oauth.password | OAuth Password | OAuth2 user password mandatory for the 'password' grant. | False | string |
oauth.scope | OAuthScope | OAuth2 scopes that should be included in the token. | False | string |
oauth.client_id | OAuth Client ID | OAuth2 client_id parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.client_secret | OAuth Client Secret | OAuth2 client_secret parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.auth_type | OAuth Authorization | OAuth2 flows supported by this adapter can receive client credentials either in the form data (body) or in the header as basic authorization. If the value of this parameter is 'basic' then client credentials will be added on the OAuth request header or in the form data. | False | string |
Response Properties
Name | Description | Type |
---|---|---|
header.* | The headers of the HTTP Response. | string |
status_code | The HTTP Status Code of the HTTP Response. | string |
content_error | This adapter expects responses with one of the supported content types. If the response content type is not supported, but the HTTP Status Code shows successful command execution, then content_error will contain some error code, and the response text will be available as part of the 'content' response property. It's up to the workflow designer to handle this error or to ignore it. | string |
oauth_error | If this command will also request an OAuth token, it means that it will actually issue two requests: one for OAuth and one for HTTP. If the OAuth request fails, then the OAuth response is returned as this command's response and 'oauth_error' will contain some description of the error. | string |
content | If the response content type is not JSON, then the content will be available as 'content' property of the response. | string |
content.* | If the response content type is JSON, then it can be accessed as properties on the 'content.*' response property. | string |
error | OAuth error responses are returned with an HTTP 400 status code (unless specified otherwise), with error and error_description parameters. | string |
error_description | OAuth access token request can return an error description, in which case it can be accessed as 'error_description' property of the command response. | string |
error_uri | OAuth access token request can return an error URI, in which case it can be accessed as 'error_uri' property of the command response. | string |
Post (post)
Build and issue a new HTTP request, using the POST http verb. Content type is by default application-json but can be overwritten by setting header.Content-Type. Other headers can be set by adding command properties named header.Header-Name. Content can be provided using the format content.property (for json) or by setting content directly (for other content types). Currently the supported response content types are application/json, text/plain, text/html and all image types (image/*). If the response content type is not supported, an error will be set in the response property content_error but the command itself will not be failed. The main reason why the command will fail, is an unsuccessful return status code.
Request Properties
Name | Display | Description | Is Required | Type |
---|---|---|---|---|
uri | URI | Specify the request URI. To override the base URI from the adapter settings page include a /. To append to the base URI do not use a / . | True | string |
header.* | Header | Each 'header.*' adds that header to the request. Replace * with the header name. Default headers specified on the adapter properties will be overwritten by headers from the command properties. | False | string |
content | Content | Overwrites other content.* properties. If content is specified, then this is the raw text content of the http request. | False | string |
contentbinary | Content Binary Data | Overwrites other content.* properties. If contentbinary is specified, then the provided base64 encoded text will be decoded and sent as a binary content. Make sure to also put in the correct content type for this request. | False | string |
content.* | Json Content | All properties specified on the content.* keys will be part of the json content of this request. | False | string |
forceJsonResponse | Force JSON Response | Force the response to be parsed as JSON regardless of the content type. | False | boolean |
basicauth.username | Basic authentication Username | Basic authentication username mandatory for the basic access authentication. | False | string |
basicauth.password | Basic authentication Password | Basic authentication user password mandatory for the basic access authentication. | False | string |
oauthtokenuri | OAuth Token URI | Token URI for OAuth2. If this value is provided, then a bearer token will be obtained and set on this request. | False | string |
oauthheader.* | OAuth Headers | Any custom headers required for the OAuth request can be specified the same way as the request properties, but prefixing them with 'oauthheader.*'. Headers specified in the adapter configuration will not be used on the OAuth request. | False | string |
oauth.grant_type | OAuth Grant Type | OAuth2 grant type used when getting the bearer token. Supported grants are 'client_credentials' and 'password'. If the token returned by the OAuth request is not of type 'bearer' then this command will fail. | False | string |
oauth.username | OAuth Username | OAuth2 username mandatory for the 'password' grant. | False | string |
oauth.password | OAuth Password | OAuth2 user password mandatory for the 'password' grant. | False | string |
oauth.scope | OAuthScope | OAuth2 scopes that should be included in the token. | False | string |
oauth.client_id | OAuth Client ID | OAuth2 client_id parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.client_secret | OAuth Client Secret | OAuth2 client_secret parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.auth_type | OAuth Authorization | OAuth2 flows supported by this adapter can receive client credentials either in the form data (body) or in the header as basic authorization. If the value of this parameter is 'basic' then client credentials will be added on the OAuth request header or in the form data. | False | string |
Response Properties
Name | Description | Type |
---|---|---|
header.* | The headers of the HTTP Response. | string |
status_code | The HTTP Status Code of the HTTP Response. | string |
content_error | This adapter expects responses with one of the supported content types. If the response content type is not supported, but the HTTP Status Code shows successful command execution, then content_error will contain some error code, and the response text will be available as part of the 'content' response property. It's up to the workflow designer to handle this error or to ignore it. | string |
oauth_error | If this command will also request an OAuth token, it means that it will actually issue two requests: one for OAuth and one for HTTP. If the OAuth request fails, then the OAuth response is returned as this command's response and 'oauth_error' will contain some description of the error. | string |
content | If the response content type is not JSON, then the content will be available as 'content' property of the response. | string |
content.* | If the response content type is JSON, then it can be accessed as properties on the 'content.*' response property. | string |
error | OAuth error responses are returned with an HTTP 400 status code (unless specified otherwise), with error and error_description parameters. | string |
error_description | OAuth access token request can return an error description, in which case it can be accessed as 'error_description' property of the command response. | string |
error_uri | OAuth access token request can return an error URI, in which case it can be accessed as 'error_uri' property of the command response. | string |
Put (put)
Build and issue a new HTTP request, using the PUT http verb. Content type is by default application-json but can be overwritten by setting header.Content-Type. Other headers can be set by adding command properties named header.Header-Name. Content can be provided using the format content.property (for json) or by setting content directly (for other content types). Currently the supported response content types are application/json, text/plain, text/html and all image types (image/*). If the response Content-Type is not supported, an error will be set in the response property content_error but the command itself will not be failed. The main reason why the command will fail, is an unsuccessful return status code.
Request Properties
Name | Display | Description | Is Required | Type |
---|---|---|---|---|
uri | URI | Specify the request URI. To override the base URI from the adapter settings page include a /. To append to the base URI do not use a / . | True | string |
header.* | Header | Each 'header.*' adds that header to the request. Replace * with the header name. Default headers specified on the adapter properties will be overwritten by headers from the command properties. | False | string |
content | Content | Overwrites other content.* properties. If content is specified, then this is the raw text content of the http request. | False | string |
contentbinary | Content Binary Data | Overwrites other content.* properties. If contentbinary is specified, then the provided base64 encoded text will be decoded and sent as a binary content. Make sure to also put in the correct content type for this request. | False | string |
content.* | Json Content | All properties specified on the content.* keys will be part of the json content of this request. | False | string |
forceJsonResponse | Force JSON Response | Force the response to be parsed as JSON regardless of the content type. | False | boolean |
basicauth.username | Basic authentication Username | Basic authentication username mandatory for the basic access authentication. | False | string |
basicauth.password | Basic authentication Password | Basic authentication user password mandatory for the basic access authentication. | False | string |
oauthtokenuri | OAuth Token URI | Token URI for OAuth2. If this value is provided, then a bearer token will be obtained and set on this request. | False | string |
oauthheader.* | OAuth Headers | Any custom headers required for the OAuth request can be specified the same way as the request properties, but prefixing them with 'oauthheader.*'. Headers specified in the adapter configuration will not be used on the OAuth request. | False | string |
oauth.grant_type | OAuth Grant Type | OAuth2 grant type used when getting the bearer token. Supported grants are 'client_credentials' and 'password'. If the token returned by the OAuth request is not of type 'bearer' then this command will fail. | False | string |
oauth.username | OAuth Username | OAuth2 username mandatory for the 'password' grant. | False | string |
oauth.password | OAuth Password | OAuth2 user password mandatory for the 'password' grant. | False | string |
oauth.scope | OAuthScope | OAuth2 scopes that should be included in the token. | False | string |
oauth.client_id | OAuth Client ID | OAuth2 client_id parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.client_secret | OAuth Client Secret | OAuth2 client_secret parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.auth_type | OAuth Authorization | OAuth2 flows supported by this adapter can receive client credentials either in the form data (body) or in the header as basic authorization. If the value of this parameter is 'basic' then client credentials will be added on the OAuth request header or in the form data. | False | string |
Response Properties
Name | Description | Type |
---|---|---|
header.* | The headers of the HTTP Response. | string |
status_code | The HTTP Status Code of the HTTP Response. | string |
content_error | This adapter expects responses with one of the supported content types. If the response content type is not supported, but the HTTP Status Code shows successful command execution, then content_error will contain some error code, and the response text will be available as part of the 'content' response property. It's up to the workflow designer to handle this error or to ignore it. | string |
oauth_error | If this command will also request an OAuth token, it means that it will actually issue two requests: one for OAuth and one for HTTP. If the OAuth request fails, then the OAuth response is returned as this command's response and 'oauth_error' will contain some description of the error. | string |
content | If the response content type is not JSON, then the content will be available as 'content' property of the response. | string |
content.* | If the response content type is JSON, then it can be accessed as properties on the 'content.*' response property. | string |
error | OAuth error responses are returned with an HTTP 400 status code (unless specified otherwise), with error and error_description parameters. | string |
error_description | OAuth access token request can return an error description, in which case it can be accessed as 'error_description' property of the command response. | string |
error_uri | OAuth access token request can return an error URI, in which case it can be accessed as 'error_uri' property of the command response. | string |
Get (get)
Build and issue a new HTTP request, using the GET http verb. Headers can be set by adding command properties named header.Header-Name. Currently the supported response content types are application/json, text/plain, text/html and all image types (image/*). If the response content type is not supported, an error will be set in the response property content_error but the command itself will not be failed. The main reason why the command will fail, is an unsuccessful return status code.
Request Properties
Name | Display | Description | Is Required | Type |
---|---|---|---|---|
uri | URI | Specify the request URI. To override the base URI from the adapter settings page include a /. To append to the base URI do not use a / . | True | string |
header.* | Header | Each 'header.*' adds that header to the request. Replace * with the header name. Default headers specified on the adapter properties will be overwritten by headers from the command properties. | False | string |
basicauth.username | Basic authentication Username | Basic authentication username mandatory for the basic access authentication. | False | string |
basicauth.password | Basic authentication Password | Basic authentication user password mandatory for the basic access authentication. | False | string |
forceJsonResponse | Force JSON Response | Force the response to be parsed as JSON regardless of the content type. | False | boolean |
oauthtokenuri | OAuth Token URI | Token URI for OAuth2. If this value is provided, then a bearer token will be obtained and set on this request. | False | string |
oauthheader.* | OAuth Headers | Any custom headers required for the OAuth request can be specified the same way as the request properties, but prefixing them with 'oauthheader.*'. Headers specified in the adapter configuration will not be used on the OAuth request. | False | string |
oauth.grant_type | OAuth Grant Type | OAuth2 grant type used when getting the bearer token. Supported grants are 'client_credentials' and 'password'. If the token returned by the OAuth request is not of type 'bearer' then this command will fail. | False | string |
oauth.username | OAuth Username | OAuth2 username mandatory for the 'password' grant. | False | string |
oauth.password | OAuth Password | OAuth2 user password mandatory for the 'password' grant. | False | string |
oauth.scope | OAuth Scope | OAuth2 scopes that should be included in the token. | False | string |
oauth.client_id | OAuth Client ID | OAuth2 client_id parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.client_secret | OAuth Client Secret | OAuth2 client_secret parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.auth_type | OAuth Authorization | OAuth2 flows supported by this adapter can receive client credentials either in the form data (body) or in the header as basic authorization. If the value of this parameter is 'basic' then client credentials will be added on the OAuth request header or in the form data. | False | string |
Response Properties
Name | Description | Type |
---|---|---|
header.* | The headers of the HTTP Response. | string |
status_code | The HTTP Status Code of the HTTP Response. | string |
content_error | This adapter expects responses with one of the supported content types. If the response content type is not supported, but the HTTP Status Code shows successful command execution, then content_error will contain some error code, and the response text will be available as part of the 'content' response property. It's up to the workflow designer to handle this error or to ignore it. | string |
oauth_error | If this command will also request an OAuth token, it means that it will actually issue two requests: one for OAuth and one for HTTP. If the OAuth request fails, then the OAuth response is returned as this command's response and 'oauth_error' will contain some description of the error. | string |
content | If the response content type is not JSON, then the content will be available as 'content' property of the response. | string |
content.* | If the response content type is JSON, then it can be accessed as properties on the 'content.*' response property. | string |
error | OAuth error responses are returned with an HTTP 400 status code (unless specified otherwise), with error and error_description parameters. | string |
error_description | OAuth access token request can return an error description, in which case it can be accessed as 'error_description' property of the command response. | string |
error_uri | OAuth access token request can return an error URI, in which case it can be accessed as 'error_uri' property of the command response. | string |
Delete (delete)
Build and issue a new HTTP request, using the DELETE http verb. Headers can be set by adding command properties named header.Header-Name. Currently the supported response content types are application/json, text/plain, text/html and all image types (image/*). If the response Content-Type is not supported, an error will be set in the response property content_error but the command itself will not be failed. The main reason why the command will fail, is an unsuccessful return status code.
Request Properties
Name | Display | Description | Is Required | Type |
---|---|---|---|---|
uri | URI | Specify the request URI. To override the base URI from the adapter settings page include a /. To append to the base URI do not use a / . | True | string |
header.* | Header | Each 'header.*' adds that header to the request. Replace * with the header name. Default headers specified on the adapter properties will be overwritten by headers from the command properties. | False | string |
forceJsonResponse | Force JSON Response | Force the response to be parsed as JSON regardless of the content type. | False | boolean |
basicauth.username | Basic authentication Username | Basic authentication username mandatory for the basic access authentication. | False | string |
basicauth.password | Basic authentication Password | Basic authentication user password mandatory for the basic access authentication. | False | string |
oauthtokenuri | OAuth Token URI | Token URI for OAuth2. If this value is provided, then a bearer token will be obtained and set on this request. | False | string |
oauthheader.* | OAuth Headers | Any custom headers required for the OAuth request can be specified the same way as the request properties, but prefixing them with 'oauthheader.*'. Headers specified in the adapter configuration will not be used on the OAuth request. | False | string |
oauth.grant_type | OAuth Grant Type | OAuth2 grant type used when getting the bearer token. Supported grants are 'client_credentials' and 'password'. If the token returned by the OAuth request is not of type 'bearer' then this command will fail. | False | string |
oauth.username | OAuth Username | OAuth2 username mandatory for the 'password' grant. | False | string |
oauth.password | OAuth Password | OAuth2 user password mandatory for the 'password' grant. | False | string |
oauth.scope | OAuth Scope | OAuth2 scopes that should be included in the token. | False | string |
oauth.client_id | OAuth Client ID | OAuth2 client_id parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.client_secret | OAuth Client Secret | OAuth2 client_secret parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.auth_type | OAuth Authorization | OAuth2 flows supported by this adapter can receive client credentials either in the form data (body) or in the header as basic authorization. If the value of this parameter is 'basic' then client credentials will be added on the OAuth request header or in the form data. | False | string |
Response Properties
Name | Description | Type |
---|---|---|
header.* | The headers of the HTTP Response. | string |
status_code | The HTTP Status Code of the HTTP Response. | string |
content_error | This adapter expects responses with one of the supported content types. If the response content type is not supported, but the HTTP Status Code shows successful command execution, then content_error will contain some error code, and the response text will be available as part of the 'content' response property. It's up to the workflow designer to handle this error or to ignore it. | string |
oauth_error | If this command will also request an OAuth token, it means that it will actually issue two requests: one for OAuth and one for HTTP. If the OAuth request fails, then the OAuth response is returned as this command's response and 'oauth_error' will contain some description of the error. | string |
content | If the response content type is not JSON, then the content will be available as 'content' property of the response. | string |
content.* | If the response content type is JSON, then it can be accessed as properties on the 'content.*' response property. | string |
error | OAuth error responses are returned with an HTTP 400 status code (unless specified otherwise), with error and error_description parameters. | string |
error_description | OAuth access token request can return an error description, in which case it can be accessed as 'error_description' property of the command response. | string |
error_uri | OAuth access token request can return an error URI, in which case it can be accessed as 'error_uri' property of the command response. | string |
OAuth (oauth)
Supports grant_type 'password' or 'client_credentials'. Expects json response with a field named access_token.
Request Properties
Name | Display | Description | Is Required | Type |
---|---|---|---|---|
oauthtokenuri | Oauth Token URI | Token URI for OAuth2. | True | string |
oauthheader.* | OAuth Headers | Any custom headers required for the OAuth request can be specified the same way as the request properties, but prefixing them with 'oauthheader.*'. Headers specified in the adapter configuration will not be used on the OAuth request. | False | string |
oauth.grant_type | OAuth Grant Type | OAuth2 grant type used when getting the bearer token. Supported grants are 'client_credentials' and 'password'. If the token returned by the OAuth request is not of type 'bearer' then this command will fail. | True | string |
oauth.username | OAuth Username | OAuth2 username mandatory for the 'password' grant. | False | string |
oauth.password | OAuth Password | OAuth2 user password mandatory for the 'password' grant. | False | string |
oauth.scope | OAuthScope | OAuth2 scopes that should be included in the token. | False | string |
oauth.client_id | OAuth Client ID | OAuth2 client_id parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.client_secret | OAuth Client Secret | OAuth2 client_secret parameter, mandatory for 'client_credentials' grant and optional for 'password' grant. | False | string |
oauth.auth_type | OAuth Authorization | OAuth2 flows supported by this adapter can receive client credentials either in the form data (body) or in the header as basic authorization. If the value of this parameter is 'basic' then client credentials will be added on the OAuth request header or in the form data. | False | string |
Response Properties
Name | Description | Type |
---|---|---|
header.* | The headers of the HTTP Response. | string |
status_code | The HTTP Status Code of the HTTP Response. | string |
content_error | This adapter expects responses with one of the supported content types. If the response content type is not supported, but the HTTP Status Code shows successful command execution, then content_error will contain some error code, and the response text will be available as part of the 'content' response property. It's up to the workflow designer to handle this error or to ignore it. | string |
access_token | The access token string as issued by the authorization server. | string |
token_type | The type of token this is, typically just the string 'bearer'. | string |
expires_in | If the access token expires, the server should reply with the duration of time the access token is granted for. | string |
refresh_token | If the access token will expire, then it is useful to return a refresh token which applications can use to obtain another access token. However, tokens issued with the implicit grant cannot be issued a refresh token. | string |
scope | If the scope the user granted is identical to the scope the application requested, this parameter is optional. If the granted scope is different from the requested scope, such as if the user modified the scope, then this parameter is required. | string |
error | Error responses are returned with an HTTP 400 status code (unless specified otherwise), with error and error_description parameters. | string |
error_description | OAuth access token request can return an error description, in which case it can be accessed as 'error_description' property of the command response. | string |
error_uri | OAuth access token request can return an error URI, in which case it can be accessed as 'error_uri' property of the command response. | string |
Use Cases
Dedicated adapter
All configuration for this adapter is optional, and should be used only when needed. The adapter will be completely functional when no configuration is provided.
Once the adapter is configured, that HttpRequest adapter will be dedicated for a specific use. Usually this is not needed, and most use cases can use a generic HttpRequest adapter (one without any configuration).
You can use a dedicated adapter when you have many requests or many workflows that all have specific configuration, either a long URI, base URI, or headers they all need.
Configure the Base URI of the adapter always ending with a /. When using a dedicated HttpRequest adapter, the commands can only contain a relative URI. If the URI set on the commands is relative, it will be appended to this base URI.
If required, configure any additional query string parameters that will be appended to every request. The query string is text appended to the URI of the command, so make sure to include the query string separator ('?') or values delimiters ('&' or ';') if required.
You can define up to three header values in the adapter configuration, each of them in the format "Header-Name:Header-Value". These static headers will be appended to all http requests issued by this adapter.
Handling success and error of the HTTP request
If the HTTP response was received, then the command property 'status_code' will contain the response status code. It will contain the status code even if it is an unsuccessful one.
If the command failed, then 'code' and 'error' will contain more details about that:
- will report configuration errors (such as invalid URI) by setting the 'code' to ERROR and the 'error' to the text of the encountered error
- will contain the http status code for requests that are not successful; in this case the 'error' will contain the status code text (ex: 'code':'401','error':'Unauthorized')
- if the error is set due to an HTTP request, then also the content could be set (if the remote server provided one). example: 'content.cod': '401', 'content.message': 'Invalid API key.')
Response content
The HttpRequest can read a JSON content or a text content as response to any request.
Currently the supported response content types are application/json, text/plain, text/html and all image types (image/*). If the response content type is none of the above, then the content cannot be accessed and a 'content_error' property will be set with a relevant message.
This will not cause the command to fail, because in some cases this might be expected.
A http command will only fail when the HTTP request failed or when the HTTP response contains an unsuccessful code.
Use the URI and the header properties of the command to specify the parameters of the HTTP request. Use an absolute URI to override the base URI from the adapter configuration. Use headers with the same name as those provided in the adapter configuration to override them. A header can only be specified once (cannot specify multiple values for a header).
If the response is JSON, then it will be available using dot ('.') to separate nested values, all under the content property of the response. See the flatten and unflatten json section of the user documentation for more information.
If the response is text/plain, text/html or any image type (image/*), it will be accessible in the command response directly as "content".
The content will be encoded as string for text/plain, text/html and application/json responses and Base64 for image/* responses.
Request content
The HttpRequest Adapter is used with JSON content type. This means that any content properties added on the command will be packed as JSON and set as the content of the HTTP POST, PUT or PATCH request. See the flatten and unflatten json section of the user documentation for more information.
The HttpRequest Adapter will add the content type "application/json" automatically when making a POST, PUT or PATCH request.
Setting the 'content' property of the command will take the exact value provided and set the content of the message to that string. In that case you should provide the Content-Type header.
Example: to POST with form data, you can set the following properties on the command:
Property Name | Property Value |
---|---|
header.Content-Type | application/x-www-form-urlencoded |
content | MyVariableOne={MyWorkflowPropertyOne}&MyVariableTwo={MyWorkflowPropertyTwo} |
Get OAuth Token
Use the 'oauth' command to obtain an OAuth token using one of the two supported flows: 'client_credentials' and 'password'.
Set the oauthtokenuri to the absolute or relative URI of the token URI provided by the server, as specified in the OAuth2 standard.
Append custom headers prefixed with 'oauthheader.' just like you add headers for a http command.
Specify oauth properties, as required by the grant type used, and add the scope of your token. For client_credentials grant, the client_id and client_password properties are mandatory and for password grant the username and password properties are mandatory.
If needed use the oauth.auth_type property to specify where to put the client credentials: if the value of this parameter is 'basic' then client credentials will be added on the OAuth request header otherwise in the form data.
The oauth properties will be stored inside a JSON content of the HTTP request.
The response of the OAuth command contains the access token and additional properties as provided by the server.
If the http response does not contain the access token and the token type, then the command will be set to failed.
Http requests with OAuth
The OAuth properties of the 'oauth' command can also be added on the http commands.
In this case, an OAuth request will be made, and the error token will be used as the bearer token of the requested http command.
The oauth command must return 'token_type'='bearer' and the value of the token as 'access_token'
If the oauth command fails, then 'oauth_error' will be set and the failed oauth response will be returned as the response of this command. In this case, the error properties of the command will be the errors from the oauth response.
Http requests with Basic Authentication
Every http command has two optional fields for basic authentication: Basic authentication Username and Basic authentication Password. If these fields are provided then the request is authenticated by adding the specific Authorization header. You should only provide a single way to authenticate a request: Basic Auth or OAuth, not both. If parameters for both types of authorization are provided, OAuth is used to authenticate the request.
Release History
Version | Type | Description | Tracking # | Date |
---|---|---|---|---|
2.0.1 | Initial | First release in the Adapter Type store. | ||
2.0.9 | Maintenance | Updated third-party components and improved maintainability. | NAP-11518 | |
2.0.10 | Maintenance | Updated third-party components and improved maintainability. | NAP-23945 | 2022-11-29 |
2.0.11 | Maintenance | Updated third-party components. | 2023-11-08 | |
2.0.12 | Maintenance | Updated third-party components and improved maintainability. | NAP-27635 | 2024-07-31 |