Create a RESTful Interface for an App From RAML in Anypoint
You can generate an entire interface from one simple API definition.
Join the DZone community and get the full member experience.Join For Free
A RESTful interface for an application will have the listener for each of the methods defined by the API to interact with it.
We can generate that interface from the API definition. Let's get started.
1. Download and install the APIKit plugin in Anypoint Studio.
2. You should have an account on Anypoint Platform to have an access to RAML API definition.
3. Write any RAML definition in API Designer based on the requirements that I have written to Customer for the kickstart.
4. Create a Mule project from the RAML definition.
5. You can create a project from a RAML definition, which is either on your local system or on the Anypoint Platform. We are going with Anypoint Platform.
6. After clicking Next, you will get all of the RAML definitions written in you Anypoint platform. Notice that the following image depicts only a single RAML Definition.
7. Select the appropriate RAML Definition and hit OK.
8. Check the project explorer, which includes the RAML definition from Anypoint Platform.
9. Check the
customer-api.xml canvas. It should show the main flow, the flow for each resource methods, and the flow for exception handling.
The main flow.
Flow for each resources methods.
The exception handling flow.
src/main/api in the project explorer or API async for RAML definition.
11. Running the
RAML-Demo project, you can see the output either on the APIKit Console or on POSTMAN.
Opinions expressed by DZone contributors are their own.