How to integrate AWX with WSO2 API Manager?

API Manager sits between the client and AWX’s REST API

Khalil SARSRI
4 min readApr 10, 2022
The API gateway provides a single entry point. Photo by Sangga Rima Roman Selia on Unsplash

Most enterprise APIs are deployed via API gateways. In this article, we’ll demonstrate how to use WSO2 API Manager as an API Gateway for AWX.

In our use case, API-M (API Manager) sits between the client and AWX’s REST API. It acts as a reverse proxy by accepting the API calls and returning the appropriate results.

When I first tried to do so, I came across some dead ends on the subject. So, here I’ll be sharing some tips that you may find useful.

If you’re familiar with API Gateways and API-M, you may jump directly to the Setup section.

About API Gateways

In the same way, HTTP servers serve websites, APIs have API Gateways in order to serve APIs in production.

The API gateway provides a single entry point. It takes all API calls from clients, then routes them to the appropriate backends.

API Gateways have many known benefits like decoupling, availability, and reducing the number of requests …

WSO2 APIM is no exception, it has a robust set of features. In our case, it will help especially around security and monitoring of our AWX APIs.

About WSO2 API Manager

WSO2 API Manager is one of the highest performant API Management solutions in the market. It’s a complete solution that supports API designing, API publishing, lifecycle management, and many other capabilities.

Although it’s an enterprise-class tool, it’s completely free, open-source, and released under Apache License.

Setup

The versions used: Ansible 2.11.3, AWX 17.0.0, WSO2 API-M 4.0.0

The AWX setup was thoroughly addressed in my previous article. So, here we’ll be going through API-M configuration only.

Step 1: Create the API on the Publisher

Connect to APIM Publisher with an admin user.

Under “Create API > REST API > Start From Scratch”, fill out the form and click on “Create and Publish”.

The endpoint should be the API URL for launching the AWX Job Template.

Step 2: Configure the Endpoint Security

Now that the API is created, we’ll configure the endpoint security.

Under “Develop > API Configurations > Endpoints”, click on “Endpoint Security”.

Select “Basic Auth” and enter the username and password.

The username and password used here are those of the AWX’s technical user.

Don’t forget to save and deploy the new API Revision.

The Revision feature is actually a new one in WSO2 API-Manager 4.0. On previous versions, if we make changes to a published API, they get reflected directly to the runtime gateways. But, now, there is a need to perform a deployment action separately.

Step 3: Create an Application on Dev Portal

To try out the new API, first, we need to connect to the Dev Portal, and create an Application.

Step 4: Generate the Application keys

The Consumer Key and Secret will be used for generating access tokens.

Step 5: Subscribe to the API

We use the newly created App.

Step 6: Generate a new access token

This can be done either via the Dev Portal, or by calling the “token” API using a utility like cURL.

curl --location --request POST 'https://*.*.*.*/oauth2/token'
--header 'Authorization: Basic <base 64 encoding of the Consummer key and secret>' --header 'Content-Type: application/json'
--data-raw '{"grant_type":"client_credentials"}'

Step 7: Try out the API

The same here, to try out the API you can use either the Dev Portal or cURL.

curl --location --request POST 'https://*.*.*.*:8243/hello-mandalorian/1.0' --header 'Authorization: Bearer access token'

Make sure that you are getting the 200 Success status response code.

And also that the job was correctly launched on AWX.

The competition in the API-Management market is highly ferocious. This may explain why such a powerful tool like WSO2 API Manager has surprisingly only <5% market share.

As of the time of writing this article, WSO2 was named Visionary by Gartner in the Magic Quadrant for Full Life Cycle Management.

So we all wonder what the future holds for this promising tool/company.

--

--