- Purpose of the Article: This Blog provides a solution to accessing API specifications to Clients/Users through the Anypoint platform using Mock URL.
Intended Audience: MuleSoft Developers. - Tools and Technology: MuleSoft, Anypoint Studio, Anypoint Platform, Anypoint Cloud.
- Keywords: MuleSoft, Anypoint Studio, Anypoint Platform, Anypoint Cloud, Public Portal, Private Portal, Public vs Private Portal
This blog explains how users (outside and inside the organization) can access the API documentation and use it further.
API Portal
API Portals connect API Providers (which build, expose, and operate APIs) and API Consumers (which develop apps using APIs.). This provides information on API Functionality and capabilities and gives away a list of APIs when updated with the new version.
Anypoint Exchange
Anypoint Exchange is used to create API Portals, view or, simulate data to APIs, create technical assets, and use API Notebooks to describe and test API Functions. In the Mule application’s lifecycle, this is a kind of repository for APIs.
AnyPoint Exchange generates policies, fragments, and connections whenever new APIs are created.
End-Users can discover and use proven assets of the MuleSoft ecosystem for internal collaboration and learning.
Publishing RAML using an Anypoint API Portal
Anypoint API Portals allow sharing of the APIs either publicly or privately. Using RAML and the API portal, API documentation that contains all the information about API Functionalities is generated automatically.
How to Create an RAML Specification?
Step: 1
Login to Anypoint Platform, navigate to Design center and click on create a new tab.
Step: 2
Select Create API Specification from the pop-up window and enter the Specification name.
Step: 3
Enter the desired name for API specification and select RAML from the Dropdown box and then click Create Specification.
How to Publish an Asset in Exchange?
Step: 1
Design the RAML according to the business standards and requirements. To enable the Mocking Service, the toggle button, located at the top right corner will generate the baseUri with a mock URL that can be used for testing the mock service.
Step: 2
Publish an API to exchange by clicking publish button, which is located at the top right corner. Once the pop-up appears then, enter the Asset version and API version. Finally, click on Publish to Exchange.
Step: 3
Navigate to Exchange to find the Asset published from the Design center, and click on the public portal in the left pane.
Step: 4
Try to search for the Asset name which was created.
Step: 5
Now It will not show up here because the asset visibility was set as private.
How to make your Asset visible to the public?
Step: 1
Click on Share to make the asset public.
Navigate to the public tab to publish it on the public portal, enable the version, and click to save.
Step: 2
Asset’s visibility changes from private to public.
Step: 3
Let us try it again. Navigate to public and search for the Asset name which was previously published in Exchange. It appears in the public portal and is ready for testing.
Step: 4
Select the Asset and navigate the API instance. It will generate the Mocking URL to test the API.
Step: 5
Copy the API instance URL, resources, and required inputs to consume using an external client like POSTMAN to get desired Response.
So, in this way, with just a click of a few buttons, get the assets transferred from the private to the public portal, so that the rest of the world can easily access the wealth of knowledge!
Author Bio:
Sai Santhosh Jana
Associate Manager
I am a MuleSoft Developer and have about 5+ years of work experience. In MOURI Tech, I have been involved in multiple projects where I have worked with multiple connectors and been involved in a couple of research activities to find the solution in project deliverables.