Making API Calls with the REST Client Object in Astera Centerprise

To make an API call in Astera Centerprise, A REST Client object, along with its REST Connection, needs to be configured.

First, drag and drop a REST Connection object from the toolbox and configure it in the dataflow. Alternatively, you can use a REST Connection object from a shared action within the scope of the project you’re working with. The connection object contains the Base URL, authentication details, and shared parameters for the API endpoint.

You can learn all about the configuration and usage of the REST Connection object here.

Next, let’s configure the REST Client object.

1. To start, drag and drop the REST Client object from the toolbox section onto the dataflow.

01-REST-Client-Object

2. Right-click on the header of the REST Client object and select Properties.

01-02-REST-Properties-Click

The REST API Client screen will open, where you will have to specify the following:

02-REST-Client-Properties

Shared Connection: Establish your REST Client’s connection from this drop-down that lists all shared connections from within the flow as well as from the project.

HTTP Method: The HTTP request verb defining the operation you want to make on the API resource.

Resource: the resource of the API from which you want to make a request. This will be appended after the Base URL from the selected shared connection to form the complete endpoint. Any URL or path parameters must be included in the resource text enclosed in curly brackets, {}.

Content Type: This is the content-type header for the request payload which is default to application/JSON type. The actual request payload layout can be defined in the input layout screen.

Note: If there comes a type that is not supported, a relevant pop-up notification will appear on-screen.

3. Click Next. A Parameters screen will appear where you will have to specify the following:

03-REST-Client-Parameters

Override Inherited Parameter: Check this to override any parameters previously defined in the shared connection.

Name: The name of your parameter.

Parameter Location: The parameter type such as Query, URI, and Header. In this example, we are using a Query parameter.

Data Type: Specify the data type of your parameter

Default Value: The parameter’s value for which you want to make a request.

Note: Any values mapped to the input node of the object will take preference.

4. Click Next. A REST Client Output Layout screen will open where we will Select Generate the Layout by Running Request to build the response layout. Then click OK.

04-Output-Layout-REST-Client

Note: Prior to this screen, there will be an additional screen to configure a REST Client input layout for the following methods: POST, PUT and PATCH.

5. Once done, click Next and you will be led to the Pagination Options screen.

Here, you can select the type of pagination that has been specified by the API providers. Astera Centerprise offers the following the pagination types.

05-Pagination-Properties

6. When that is done, click on Next and you will be taken to the Service Options screen.

07-Service-Options-Checkboxes-REST-Client

Ignore HTTP Status Codes: Selecting this option will show the results for responses other than 2xx in the flow, which are otherwise considered an error.

Continue on Retry Failure: Selecting this checkbox will let the program continue if there is a failure.

Use Parallelism: Check this to send requests in parallel.

08-Service-Options-REST-Client

Include Content as String: Adds a field for serialized content text in the Response-Info output node.

Include Response Headers: Adds all response headers as a collection in the Response-Info output node.

Include Raw Bytes: Adds a field for content in the form of raw bytes in the Response-Info output node.

7. Click Next and the Config Parameters screen will appear.

Config Parameters can enable the deployment of flows by eliminating hardcoded values and provide a dynamic way of changing multiple configurations with a simple value change.

09-Config-Parameters

8. Click OK and the REST Client object will be configured.

Now, right-click on the header of the REST Client object and select Preview Output.

Your request has successfully been executed as you can see that HTTPStatusCode is 200 which means that the REST Client has successfully carried out the GET request for the provided status.

10-Data-Preview-REST-Client

This concludes our discussion on making API calls with the REST Client object in Astera Centerprise.