Build OAS from Postman collection
Some providers don't provide an OpenAPI specification file but a Postman collection. Maybe you also use a Postman collection for your own APIs.
Brace yourself: you can convert them to create a OpenAPI specification file and import your API inside Meta API!
This is a step-by-step guide to help you to convert and import a Postman collection inside Meta API.
Step 1: export the Postman collection
For this example, we'll use the SimilarWeb API that provide a Postman collection.
The first step is to download this collection. If you have a web page from Postman like this, you can click Run in Postman to download the collection inside your Postman client (or the web app):
Then, click on the three dot in front of the collection and select Export
Select the recommended version and click on Export. You will be able to save the file on your computer.
Step 2: convert the Postman collection
The will the APIMatic Transformer tool to convert our Postman collection to an OpenAPI specification file.
Click on Convert now on their website.
You'll have to create a free account on their website to do it.
Once on the transformation popup, choose the downloaded Postman collection on your computer, select OpenAPI v3.0 (JSON) and click on Convert
You may encounter some warning inside the API: you can skip them and click on Proceed to download the OpenAPI file.
Now you have an OpenAPI specification file, but we need to check the authentication.
Step 3: check authentication on the generated OpenAPI file
Most of the time, the authentication is now configured inside the OpenAPI file, because the transformer can't detect the right authentication method.
If you know the OpenAPI standard, you can add the authentication manually to the file (or with your favorite tool), but in this example, we'll use the Stoplight app to edit it.
You can download it, create a new local project and then import the OpenAPI file.
Since each API is different, the following examples only apply to SimilarWeb.
But for each APIs, you'll have to configure a Security Schema as use this schema in Global Security
After examining the SimilarWeb API, I figure out that SimilarWeb use an API key as a query params in each endpoint, like this:
So I'll configure a new Security Schemas that'll use an API key with the name api_key
inside a query
param.
And I set this Security Schema as the main one inside Global Security
To make my OpenAPI file cleaner, I've also removed the query parameter referring to the api_key
on each endpoint.
Then, I can export my OpenAPI file from Stoplight by doing a right click on my file and select Export:
Select the JSON format with Bundled references and click on Copy to clipboard
Step 4: import your new API inside Meta API
Go on your Meta API account, select Catalog on API on the left menu bar and click on the button Add an API on the top right
You can directly paste your OpenAPI specification file inside the Open API Specification or Swagger file and it'll fill up all the others fields.
Select one or more categories for your API and then click on the Save button
Your API is now ready to use inside Meta API!