Tasks
API Call
The API Call task is utilized to interact with an external API, enabling the retrieval of data that can be subsequently utilized in subsequent tasks.
Use cases
- Integrate seamlessly with a REST API endpoint.
- Perform a POST request with a specified body.
- Trigger an API call upon executing a specific action.
- Retrieve data from third-party systems.
- Call an API endpoint requiring client certificate authentication.
- Invoke a webhook on a stub.
Basic usage
Parameters
required string
apiurl The endpoint that the task will invoke. If there are any query strings or URL parameters required, they should be specified here.
optional string
method The HTTP method to be used for the API call.
For example you can use GET, POST, PUT, DELETE, PATCH.
Any HTTP verbs are supported.
Default: GET
optional object
headers Any headers that you wish to include in the request. This is where you would typically put the Authorization header.
Default:
optional object
body The body in JSON that you would like to send as part of a PUT or POST request.
The body would typically use variable substitution so that you can replace values with some values from the stub or stubpost.data.
optional number
timeout The seconds after which the apicall
will time out.
Default: 10
optional array or object
org_credentials The org credentials to use for an API call. This requires setting up the org credentials on the Credentials page of Stubber Manage.
Example:
`
Default: 10
Result
Properties
apiresult.status
The status code indicating the outcome of the API call.
apiresult.statusText
A textual description of the result status.
apiresult.body
Contains the body of the API result, providing the actual data retrieved from the external API.
Examples
These are some more complex examples
Request with body
Include a body in your apicall request
Request with headers
Include custom headers in your apicall request
Custom Header Org Credential
This requires the Custom Header credential to be created in the organization's Credentials page of Stubber Manage.
OAuth Org Credential
This requires the Generic OAuth credential to be created in the organization's Credentials page of Stubber Manage.