As you know APPSeCONNECT provides a REST node to connect any REST API. Now sometimes you might face challenges to ensure the configuration you do inside the REST application; in some cases, APPSeCONNECT does not correctly work for a particular API even though the same API works for Postman.
In this article, we will discuss some of the interesting facts or differences that an API called from Postman differs from the one connected through APPSeCONNECT.
If you have multiple systems running in your business, connect all of them under one single platform to automate the business process and improve your productivity and efficiency!
URL Construction to Configure APIs
URLs are one of the major concerns while connecting an API. In the case of Postman, you will need to provide the entire URL that is connecting to a resource directly in the Address URL. A fully qualified URL in APPSeCONNECT has two parts. Let us take an example :
"https://webdomain.appseconnectapi.com/customers/all"
Now if this is an URL pointing to the customers, in the case of APPSeCONNECT we break it into two parts :
1. Base URL
2. Resource Path
As in APPSeCONNECT, you would use the same base URL to retrieve data from multiple endpoints, we define the BaseURL in credentials while the resource paths into Actions.
Hence in the above case, while creating the integration you will only concentrate on “customers/all” which will be the Endpoint URL for the API, such that when the nodes in ProcessFlow get executed, it automatically contacts the Base URL with the Resource Path to generate the actual output.
Remember, the last slash will go directly inside the Credential section. We keep this as a standard to ensure we always follow such things in our adapters. Removing the leading forward slash will make the URL malformed.
Action Types
When defining an Action, we generally ask for two types of Filters.
1. Action Filter: This is used for regularly scheduled operations.
2. Error Filter: This is used to filter data for a particular record. Generally executed when you resync a failed item.
Hence when defining an Action, you will get two tabs, for each operation and you can define the Action filter and the Error Filter from the same screen.
Method
REST requires HttpMethod heavily to communicate the data to the API. Now a method can be GET, POST, PATCH, etc. depending on the operation, you can choose your HttpMethod in the Action filter screen.
Please note: Do not confuse an HttpMethod with the APPSeCONNECT Node Type. A node type is used to determine what kind of operation the node is capable of. For example, if you pick NodeType as GET, that means the node will get the data by calling an API action, while if the NodeType is mentioned as POST, it will take the input directly from the previous node.
In the case of HttpMethod, sometimes a GET node type requires a POST HttpMethod. That means you want to fetch data from an API using the POST method, in such a case, you have to choose to GET as NodeType, while the operation HttpMethod will still be POST.
Query Parameters
Query parameters are specified using the Parameters tab. The Query Parameters can be computed as well as it can be static, the result will be appended in the resource URL. In the case of Postman, you are only allowed to specify static parameters, but here mostly you would create computed query parameters either through Variables or through Functions. For example,
https://webdomain.appseconnectapi.com/customers?apiKey=29843&createdDate=9/9/2021&page=1
Now here three parameters need to be passed to get the data from the Resource. To configure this, you might want to add parameters inside the Operation.
Here you can see the three parameters were added, but a static value is not mentioned. We are calling an App Resource to get the session Id for an API key, while we are using Variables to populate the values for CreationDate and Page. When the resource is actually called, the data will be replaced by these values dynamically.
Authorization
Authorization in the case of REST is done through the Credential section. You can pick any type of Authentication type and depending on the type you choose, it will ask for proper credential values. For example, Postman supports Basic, OAuth 2.0, etc.
Headers & Body
As per Postman, APPSeCONNECT Action also provides the Header and Body section, which you can use to define the Request structure. If your NodeType is GET, then you might want to define body from the Body tab, in case your HttpMethod requires it, or otherwise, the body will be fetched from the Transformation output.
Configuring an API from Postman to APPSeCONNECT
Let us say we take an API that is correctly configured in Postman and we try to convert the same in APPSeCONNECT. We take a Magento API for Customers which is correctly configured in Postman and we try to do the same thing in the REST app.
Here we use the OAuth 2.0 API to configure the authorization. To configure the same API in APPSeCONNECT, we will follow the steps.
- Create a new ProcessFlow.
- Drag a REST Node, choose GET as NodeType (As here we try to fetch data from an API).
- Create an Action and add an Action filter.
- Here you can see in parameters we have specified a variable, which will be replaced by the value 3 in actual execution.
- In the header tab, you can add all the headers required.
- Finally, when you deploy you will be asked to add Credentials.
- In the credential section, you can choose OAuth 2.0 as an authentication type and similar to PostMan you can configure the credential to ensure you connect to the application correctly.
- After you configure everything correctly, you can deploy and execute the ProcessFlow. The ProcessFlow executes and gets the data directly from the Application.
Conclusion
Hence, if you have any API configured inside your PostMan, you can easily configure the same in APPSeCONNECT to ensure the data transfer happens correctly.
I hope this will help. Thank you.
Feel free to comment.
If you have multiple systems running in your business, connect all of them under one single platform to automate the business process and improve your productivity and efficiency!
APPSeCONNECT is a smart and robust business application integration platform that seamlessly connects all your business applications with each other to streamline operations and facilitate the free flow of data across the platforms. By moving into the region of iPaaS, APPSeCONNECT proves to be a best-in-the-class platform that easily connects systems and automates the business process.