Using REST Client Outside the Scope of the Project¶
The REST Client object in Astera Centerprise can be used outside the scope of a project, such as in a dataflow. The REST API Browser is dependent upon the project, which is why when using REST Client outside the project’s scope, we have to make each request manually.
To use the REST Client object in a dataflow, follow the steps below:
2. Right-click on the header of RESTConnection object and select Properties.
The REST Connection window will open where you can specify the Base URL of the API using which you can establish your REST Client’s connection. Specify the Security Type, if your API requires authentication, otherwise click OK.
In this scenario, we are using Petstore’s open API definition. So, we do not need any authentication.
3. Right-click on the header of the REST Client object and select Properties. The REST API Client screen will open where you will have to specify the following:
Shared Connection – the shared action using which you want to establish your REST Client’s connection
HTTP Method – the HTTP request which you want to make
Resource – the resource of the API which you want to make a GET request from
Content Type – JSON, by default. If there comes a type which is not supported, a popup notification will appear to prompt the the content type is not supported. Click ok, then the new content type starts appearing in the properties
4. Click Next. A Parameters screen will appear where you will have to specify the following:
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 GET request. In this case, it is “available.”
5. 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.
6. 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 GET request for the “available” status.
This concludes working with REST Client object outside the scope of the project in Astera Centerprise.