Integrating Postman with your HCL Automation Orchestration suite REST APIs: A Practical Guide12/19/2024 Postman is a powerful tool especially made to simplify development, testing and usage of HTTP calls. Postman even offers API integration via the import of OpenAPI 3.0/3.1 specification definitions (previously known as Swagger) directly from JSON/YAML files. Check Postman documentation for other supported formats. Other tools like Swagger Editor / Swagger UI offer ways to interact / work with APIs. The direct usage of SwaggerUI doesn’t offer ways to save your configurations or your queries, and it does not let you play with headers and parameters with enough freedom. Furthermore, you cannot set up a test environment and you have limited information regarding sent requests or received responses. What if we told you that it is possible to overcome all of these limitations? Why should I use Postman with the HCL Automation Orchestration Suite? Parametrizing and customizing API usage can make your Postman client re-usable for several engines and this can be very useful when engines expose the same APIs! APIs v2 are a common layer between several HCL products like HCL Universal Orchestrator and HCL Workload Automation. Using the same APIs makes an API client like Postman very versatile, especially for monitoring purposes. NOTICE: some REST APIs are supported / not supported based on the engine type. This means I can make the same HTTP request towards different engines? Theoretically, yes. Practically, based on the specific engine, you have to provide some different information especially regarding the authentication, the eventual engine name and the base url where the target engine exposes external APIs. Then you are ready to go. I want to do this now! Ok we understand you are enthusiastic about this, but don’t forget that it is only an API tool, there are more important things in life like friends, family, hobbies, love! Joking aside, let’s get down to business. To use all Postman features regarding the importing of APIs, like selecting a local OpenAPI file to import, you need the desktop version of Postman and have to be signed in. Where do I find the OpenAPI file to import? Based on the product you are referring, you can download the yaml/json file from the following urls:
(on HWA you can find the json file in the following path: /opt/wa/usr/servers/engineServer/apps/TWSEngineModel.ear/TWSdRESTWeb-{{product.version}}.war/WA_API3_v2.json ) Follow the image below for the button to download the file: Importing the file Once you have your file, open the Postman app and select the Import button and then click on files in order to retrieve the JSON/YAML OpenAPI file. The next step is to choose between creating a Postman Collection only or importing the definition itself, enabling you to eventually make changes and navigate through the definition. For our purposes we will only create the collection. By selecting View Import Settings you can customize some importing options. You can refer to the description for their usages or online documentation. In this case, referring to V2 REST APIs available for both HCL Workload Automation and HCL Universal Orchestrator it’s suggested to have the followings:
Now you have your new collection APIs ready to be used. Setting up the environments Before proceeding, let’s create a couple of Environments to help us interact with our engines by configuring authentication and variables at once. By navigating to the Environments tab you can configure global variables and then create an environment for each engine you want to work with. Let’s put the information we need in global variables: Furthermore you can create a couple of environments. In this example we are using two different baseUrls for the two instances, respectively intended to be used with an UnO instance and an HWA instance. Customize your collection You can move back to Collections and edit the imported collection to bind it to a specific Environment. You can then move to the Authentication tab to specify which authentication to use. In this example we are using the variable {{bearerToken}} previously added as a global variable. Everything is set up! For the following example let’s assume we are working with the Universal Orchestrator environment and we want to query job definitions V2 by providing an oql (orchestration query language). As you can see the {{baseUrl}} is pre-configured by using associated variables, which means we do not have to provide authentication info again. By using the top right dropdown you can change the Environment you are targeting on the fly. In this example we just switched to the Environment configured to interact with the existing HWA instance and performed the query again: Conclusions Postman offers a lot of features to help developers, testers and HCL Automation Orchestration Suite customers. You can create tests and set up an automation suite to interact with the environments you configured. The suggested setup might especially help in multi-engine setups when you want to have the best of the two worlds or make comparisons or assumptions between engines. The world is full of possibilities, your only limit is your imagination!
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
Archives
October 2024
Categories
All
|