© Copyright 2023, Astera Software
Users can create and maintain custom API collections in case the API provider does not offer existing documentation for its APIs.
From the API Browser, open the import wizard and select Custom API as the API Import Source.
Next, provide a Name for your custom API and the Base URL of the API provider. Upon import, a new API shared connection (.sact) and a Custom-API (.capi) file will be created in the project.
Alternatively, the custom API can also point to an existing pre-configured connection from the project.
You can configure the API connection object in the shared connection file by providing valid authentication and defining parameters, if needed.
Once you are done configuring the connection object, the CAPI file will open in the API browser.
To add API requests to your custom CAPI file, click the Add Request icon from the top toolbar menu of the API browser.
Here, define the following request properties:
Request Name: This is used as the request name and description.
Resources: The unique request resource path including the URI or path parameters which appends after the Server Base URL.
HTTP Method: Select the standard HTTP method to be used for this request.
The request will be added to the CAPI file in the API Browser. Repeat this process to add all the required requests in your CAPI file.
Once you have populated the requests in your CAPI file, it may look something like this in the API browser.
Note: You may have to include a URI parameter in the resource for some requests. Some API documentations display the URI parameter after a (:) symbol. However, you will have to replace the colon ( : ) with curly brackets ( {} ) for the parameter to be considered as URI.
To configure the parameters, input/output layout, or pagination options for any request, right-click on it and choose the Edit Request option.
You can also configure and save the request properties by dragging and dropping.
Drag the request from the API browser to a flow designer.
Right-click on the API Client and select Properties. Make changes to the properties of the API client object.
To save the changes, simply drag and drop the client object back to the API browser from the flow designer.
Once you are done populating your CAPI file by configuring all request properties and authentication, click on the Save CAPI file icon on the top of the API browser to save your changes.
This will save all the configurations you have made including parameters, input/output body, and pagination settings to the request.
Sharing and adding the CAPI file to a new project
Fully configured CAPI files act as a connector for your API provider. If you want to add the CAPI file to another project, right-click on the CAPI file from the project explorer and click on copy full path.
Then open the other project, right-click on the folder you want to add the CAPI file to, and click on Add Existing Items.
A box will open. Paste the file path in the box next to the File name and click Open.
The CAPI file will be added to the project along with its corresponding .Sact file.
This concludes the basic concepts of working with the API Browser in Astera.