- 08 Jun 2023
-
DarkLight
-
PDF
restCall
- Updated on 08 Jun 2023
-
DarkLight
-
PDF
restCall Task Purpose
The restCall task is an extremely powerful and flexible task for obtaining and posting data to and from external API data sources. If a specialized adapter is not available, then restCall will likely be the first task you will consider as a way to interact with your external data source.
Refer to Proxy Settings for Pre-builts if the restCall needs to access an endpoint on the other side of a proxy.
Potential Use Case
You are developing an automation for employee on-boarding that will automatically create user accounts to your external systems via API. One restCall task can retrieve the list of users from an API accessible data storage. Another restCall task can leverage the creation of user accounts via API calls to the external systems.
Properties
Input and output properties are outlined below.
Incoming | Type | Description |
---|---|---|
uri |
String | Required. The URI for the REST call. |
verb |
Enum | Required. The verb for the REST call (options are: DELETE, GET, PATCH, PUT, POST). |
user |
String | If required, the username by which the REST call should be authenticated. |
password |
String | If required, the password by which the REST call should be authenticated. |
headers |
Object | Any custom headers. |
body |
Object | The body for the API call. |
responseHeaders |
Boolean | Required. Indicates if the response should include headers. |
Outgoing | Type | Description |
---|---|---|
response |
Object | The response from the REST call. |
Example 1
In this IAP example, a simple "GET" call is executed.
-
The
uri
value is statically set tohttps://deckofcardsapi.com/api/deck/new/shuffle/?
. -
The
verb
value is statically set toGET
. -
The API being referenced is a very simplistic API and does not require any input for the variables
user
,password
,headers
, orbody
. -
The
responseHeaders
value has been set to "True". -
The outgoing
response
will contain information relevant to the REST call. In this case, adeck_id
, the number of cardsremaining
in the deck, and a value to indicate if the virtual deck wasshuffled
. Because theresponseHeaders
value was set to "True", the response will include headers data such as content-type, etc.{ "success": true, "deck_id": "tay82vn7nlsu", "remaining": 52, "shuffled": true }
Example 2
In this IAP example, a simple "POST" call is executed.
-
The
uri
is statically set tohttps://petstore.swagger.io/v2/pet
. -
The
verb
is statically set toPOST
. -
The API being referenced does not require an input value for
user
,password
, orheaders
. -
For this specific REST call, a reference variable for the
body
is required by the API, as shown below.See documentation for petstore.swagger.io.
{ "id": 7777778888889956565, "category": { "id": 0, "name": "Pronghorn" }, "name": "Delores", "photoUrls": [ "http://example.com/images/Pronghorn01.png" ], "tags": [ { "id": 0, "name": "string" } ], "status": "available" }
-
The
responseHeaders
value is set to "False". -
In this REST call, the outgoing
response
object will contain nearly identical information as posted in thebody
. In this case, the outputresponse
is confirmation that a pet Pronghorn named "Delores" has been added and is now available for adoption at the mythical pet store. The value provided within theresponse
will vary depending on the REST call and API provider.
Example 3
In this IAP example, a simple "GET" call is executed.
-
The
uri
is statically set tohttps://api.sunrise-sunset.org/json?lat=33.791570&lng=-84.389510&date=today
. -
The
verb
is statically set toGET
. -
This particular REST call does not require values for
user
,password
, orbody
. -
A variable for the
headers
is also not required; however, for the sake of this example, let's specify the followingheaders
value:{ "Content-Type": "application/json; charset=utf-8" }
-
The
responseHeaders
variable is set to "True". -
The outgoing
response
object will contain sunrise and sunset time information for the Itential home office in Atlanta, GA.{ "results": { "sunrise": "10:46:46 AM", "sunset": "12:41:22 AM", "solar_noon": "5:44:04 PM", "day_length": "13:54:36", "civil_twilight_begin": "10:19:17 AM", "civil_twilight_end": "1:08:51 AM", "nautical_twilight_begin": "9:45:55 AM", "nautical_twilight_end": "1:42:14 AM", "astronomical_twilight_begin": "9:10:21 AM", "astronomical_twilight_end": "2:17:48 AM" }, "status": "OK" }