REST Connector
Overview#
The REST Connector task allows a workflow to directly make an HTTP request to a specified URL. The REST Connector task provides a simple way to integrate external services or APIs without needing a custom worker or microservice.
{ "_name": "rest_connector_task", "_type": "REST_CONNECTOR", "_sequenceno": 1, "_inputParams": { "_url": "https://reqres.in/api/users/2", "_auth": { "_type": "NoAuth" }, "_args": { "headers": { "x-api-key": "reqres-free-v1" } }, "_to": "file" }}Rest Connector parameters#
| Parameter | Type | Optional | Description |
|---|---|---|---|
_name | String | No | Name of the REST connector task |
_type | String | Yes | Enter REST_CONNECTOR |
_sequenceno | Number | No | Defines the execution order of the task within a workflow |
_inputParams | Object | No | An object that describes the task's parameters |
_url | String | Yes | The URL of the request for which data is to be fetched |
_auth | Object | Yes | Authentication configuration for the REST request. It takes an object which can have two keys: _type This is a required value. It must be a string and has to be one of the supported authentication schemes. The other key is _params which is on object and is optional. It is based on the required authentication scheme. To see a list of the authentication schemes supported, refer to Supported authentication schemes |
_type | String | Yes | Specifies the authentication method, for example, NoAuth, Basic, Bearer. Refer to Supported authentication schemes |
_args | Object | No | Additional arguments for the REST request such as headers or query parameters. |
_to | String | No | Defines the output destination of the response, for example, file. |
Supported authentication schemes#
Use the _auth parameter to select the required authentication scheme for the REST request.
The Rest Connector supports the auth schemes listed below:
- No auth
- Basic auth
- Bearer token
- OAuth2 - client credentials
- OAuth2 - password grant
- OAuth2 - client credentials as JSON body
Refer to the descriptions below of each auth scheme.
No auth#
| Parameters | Description |
|---|---|
| No parameters required | Just makes an API call without any authentication. |
Basic auth#
To use the basic auth approach do the following:
- Encode username and password as base 64.
- Send the encoded string in
Authorizationheader(Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==)
| Parameters | Type | Required | Description |
|---|---|---|---|
_username | string | required | Username |
_password | String | required | Password |
Example of basic auth:#
"_inputParams": { "_url": "<url>", "_auth": { "_type": "BasicAuth", "_params":{ "_username":"<username>", "_password":"<password>" } }, "to": "json", "fileName": "<File Name With extension>" }Bearer token#
To use the bearer token approach:
- Send the bearer token in
Authorizationheader (Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NTgyODQ2OTMsInVzZXJfbmFtZ..)
| Parameters | Type | Required | Description |
|---|---|---|---|
_token | string | required | Token type |
Example of bearer token:#
"_inputParams": { "_url": "<url>", "_auth": { "_type": "BearerToken", "_params":{ "_token": "<token>" } }, "to": "json", "fileName": "<File Name With extension>" }OAuth2 - client credentials#
To use the Oauth2 client credentials approach, do the following:
- Get token useing client ID and client secret.
- Make a HTTP request to the URL with the token as bearer token.
| Parameters | Type | Required | Description |
|---|---|---|---|
_tokenUrl | string | required | URL of token |
_clientId | string | required | Client ID |
_clientSecret | string | required | Client password |
_scope | string | optional | Range of request query |
Example of OAuth2 - client credentials:#
"_inputParams": { "_url": "<url>", "_auth": { "_type": "OAuth2ClientCreds", "_params":{ "_tokenUrl": "<token>", "_clientId": "<clientId>" "_clientSecret": "<clientSecret>" "_scope": "<scope>" } }, "to": "json", "fileName": "<File Name With extension>" }OAuth2 - password grant#
To use the OAuth2 password grant approach, do the following:
- Get the token using the password grant. For more information, see OAuth 2.0 Password grant.
- Make a HTTP request to the URL with the token as bearer token.
| Parameters | Type | Required | Description |
|---|---|---|---|
_tokenUrl | string | required | URL of token |
_clientId | string | required | Client ID |
_clientSecret | string | required | Client password |
_scope | string | optional | Range of request query |
_username | string | optional | username |
_password | string | optional | password |
Example of OAuth2 - password grant:#
"_inputParams": { "_url": "<url>", "_auth": { "_type": "OAuth2PasswordGrant", "_params":{ "_tokenUrl": "<token>", "_clientId": "<clientId>" "_clientSecret": "<clientSecret>" "_username":"<username>", "_password":"<password>" "_scope": "<scope>" } }, "to": "json", "fileName": "<File Name With extension>" }OAuth2 - client credentials as JSON body#
To use the OAuth2 - client credentials as JSON body approach, do the following:
- Get the token using client ID and client secret by passing that information in the request body.
- Make a HTTP request to the URL with the token as bearer token.
| Parameters | Type | Required | Description |
|---|---|---|---|
_tokenUrl | string | required | URL of token |
_clientId | string | required | Client ID |
_clientSecret | string | required | Client password |
_scope | string | optional | Range of request query |
Example of OAuth2 - client credentials as JSON body:#
"_inputParams": { "_url": "<url>", "_auth": { "_type": "OAuth2ClientCredsJSON", "_params":{ "_tokenUrl": "<token>", "_clientId": "<clientId>" "_clientSecret": "<clientSecret>" "_scope": "<scope>" } }, "to": "json", "fileName": "<File Name With extension>" }