We would like to thank Angel Alberici for their contribution to this developer tutorial.
Anypoint Exchange provides API features to the MuleSoft Developer Community for publishing and consuming assets using Mavin Facade and searching for assets using the Graph API. When developing with MuleSoft, developers might find it easiest to manage their API specifications using Anypoint Platform APIs. In this tutorial, you will learn how to programmatically manage your API specifications via Postman.
Before we start, you can download the collection/environment by clicking the following button.
If you are new to Postman or Platform APIs, make sure you have seen this article on MuleSoft Platform APIs to understand the basics from Platform APIs, Exchange, and Design Center — and to ensure that Postman is set up correctly with the collection/environment imported and the right values for the authorization token, Organization ID and Environment ID.
You can also get the public Postman collection pack by following this developer tutorial.
The first step is to decide what Business Group to work on and add the Business Group ID to your Postman environment variable
business-group-id, see the animation below on how to get your Business Group ID (called Organization ID for the Master Business Group). Go to access management, then organizations, and click the desired Business Group.
We need an API specification and an Exchange Asset, click the button below to download the ZIP.
Go into Exchange, click on Publish New Asset then select REST API > Upload a RAML and upload the ZIP file you just downloaded. Click on Publish.
First, update the Postman variables (
asset-version) with the values you selected to create your asset. In this case, we will use
e-american-flights-api for the name and
1.0.0 for the version. Now, add the tag flights to this asset. In Postman, look for the Exchange folder then the Tag folder. Click on the Add Tag to Asset request. Once you run this request, you should see an empty response and a 204 No Content status being returned.
Instead of adding a tag directly to an asset, categories are slightly different as they consist of two steps. First, you need to create the category and only then you can link it to a specific asset. Let’s start creating a Category API Layer with the value Experience API. In the Categories folder of your Postman collection, find and run the Create Category request. Below you can see how it will look when it is successful.
We want that category to be shown (linked) to our asset. To do that, go to the Category folder and run the Link Category to Asset request.
Similar to Categories, let’s add a Field Support Team with the email
firstname.lastname@example.org. Open the Fields folder and the Create CustomFields request.
Once done, you can go into the Field folder and open the Link Field to Asset request. Send the request to add the email.
We have added Categories, Fields, and Tags to our asset through HTTP requests, this is how it should look now.
We hope that this tutorial provided you with an introduction to using the Anypoint Platform APIs to manage your API Specifications by adding metadata for discoverability. There are so many additional ways you can use these Anypoint Platform APIs to manage your APIs and integrations. Please share with us how you are using the Anypoint Platform APIs or any feedback on this tutorial by tweeting to @MuleDev.
Visit the developer tutorials homepage to keep learning or head to the next tutorial to learn about the public Postman collection pack.
Click on the Next button below to continue to the next tutorial.