REST API Browser (Beta)¶
What is an API?¶
API (Application Program Interface) is defined as an interface or medium through which one software communicates with another. In other words, it is a set of contracts that allows different software systems to share information with each other. The greatest advantage of an API is that different programs and devices can communicate with each-other safely without knowing or interfering with the insides of the other.
APIs are messengers that conform with the technical contract between two parties. They are language independent and platform independent which means C# can talk to Java and Unix can communicate with Mac without any difficulty. An API is not same as a remote server. In fact, it is a part of a remote server that receives requests and sends responses. More precisely, an API is a structured request and response.
REST API Browser (Beta) in Astera Centerprise¶
The REST API Browser (Beta) in Astera Centerprise has narrowed down the steps to make HTTP calls to just one step authentication. Once you have imported an API in Centerprise, all the call methods in that particular API are populated at once. API definition describes what requests are available and what the responses will look like. So, once you load an API definition all the supported methods are populated in the REST API Browser (Beta). Unlike Legacy where all the supported methods have to be configured separately in each object.
There are three methods for configuring APIs in Astera Centerprise. For open APIs, you only need to provide the API Import Source and File path or Base Url to configure the connection with a specific API. Whereas for custom APIs, you need an API Import Source, Name and Base URL. Once all of this standardized information is provided, any API that you have imported will populate in Centerprise’s REST API Browser(Beta) along with their methods, for example, GET, PUT, POST, and DELETE and they will remain accessible until their authentication period expires. From the REST API Browser (Beta) in Astera Centerprise, you can simply drag and drop those operations and use them in your dataflow or workflow.
It is important to note that an integration project must be created before importing APIs to work with the REST API Browser (Beta) in Astera Centerprise. However, you can access the API without a project too. For that you would need a REST API Connection in your dataflow or workflow.
The REST API Browser (Beta) in Astera Centerprise, along with all of its features and functionalities, works only within the scope of an integration project. Else it will give you the following error:
When a user imports an API, a shared connection file gets created within the project automatically. The shared action file contains the Base Url of the imported API.
HTTP Request Methods¶
Astera Centerprise supports the following HTTP request methods:
- PUT: To send data or parameters to a specified resource to be processed on an API.
- GET: To retrieve data from a specified resource on an API.
- UPDATE: To update an existing record on an API.
- DELETE: To delete a specified resource on an API.
Creating an Integration Project for REST API Browser (Beta)¶
To work with REST API Browser (Beta) in Astera Centerprise, you must first create an integration project.
Follow the steps below to create an integration project in Astera Centerprise:
1. Go to Menu Bar> Project> New> Integration Project.
Provide a name to the integration project and point the path to the location and directory where you want to save it.
Best Practice: Always create a new project in a new folder to avoid any errors.
2. Now open the REST API Browser (Beta) panel on your Centerprise client from Menu Bar> View> REST API Browser (Beta).
3. As you click on it, a REST API Browser (Beta) panel will open on the left side of your Centerprise client window.
Here, you can see three icons in the toolbar of REST API Browser (Beta):
- Import API – by clicking on this option you can import different APIs
- Remove API from browser – this option removes the selected API from REST API Browser (Beta)
How to Import APIs in Centerprise¶
To import an API in Astera Centerprise, click on (Import API*)* icon. An Import API screen will open.
Here, first you need to select the API Import Source type from the drop-down menu. Astera Centerprise offers three ways to import APIs.
Type 1 – Json/YML File¶
1. Json/Yml File – for this type of API source you only need to provide the Open API Specification file path in Json or Yml file formats
2. Specify the file path and click on OK.
This API will be populated in the REST API Browser (Beta) panel from where you can simply expand the nodes and drag and drop the methods on to your designer window. In this case, we will drag and drop the call object onto a dataflow designer.
Type 2 – Json/YML URL¶
1. Json/Yml URL – for this type of API source, you need to provide the URL in Json or Yml format
2. Specify the URL and click on OK.
This API will be populated in the REST API Browser (Beta) Panel.
Type 3 – Custom API¶
1. Custom API – for this type of API source, you need to provide Name of the custom API and URL in Json or Yml format.
2. Name your custom API and provide the base URL. Then click OK.
You will see that a node has been created in the REST API Browser (Beta) panel by the name ServerInfo where you can add your APIs.
To learn how to authenticate Centerprise’s Server API, click here.
Now, right click on ServerInfo node and select Add Request to add methods.
A wizard will open where you can add details of your new API and click OK.
You can add as many methods as you want. For example, a GET method for generating Xml for URL resource can be added by following the same method.
This concludes the basic concepts of working with REST API Browser (Beta) in Astera Centerprise. To further learn how to make different HTTP requests through REST API Browser (Beta), click here.