Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Create a RESTful Interface for an App From RAML in Anypoint

DZone's Guide to

Create a RESTful Interface for an App From RAML in Anypoint

You can generate an entire interface from one simple API definition.

· Integration Zone
Free Resource

Modernize your application architectures with microservices and APIs with best practices from this free virtual summit series. Brought to you in partnership with CA Technologies.

A RESTful interface for an application will have the listener for each of the methods defined by the API to interact with it.

GET:cust\ 

GET:cust\{ID} 

POST:cust\ 

We can generate that interface from the API definition. Let's get started. 

1. Download and install the APIKit plugin in Anypoint Studio.

Image title

Image title

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.                   

Image title

4. Create a Mule project from the RAML definition.

Image title

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.

Image title

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.

Image title

7. Select the appropriate RAML Definition and hit OK.

8. Check the project explorer, which includes the RAML definition from Anypoint Platform.

Image title

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.

Image title

The main flow.

Image title

Flow for each resources methods.

Image title

The exception handling flow.

10. Check src/main/api in the project explorer or API async for RAML definition.

Image title

Image title

11. Running the RAML-Demo project, you can see the output either on the APIKit Console or on POSTMAN.

Image title

APIKit console.

Image title

POSTMAN.

The Integration Zone is proudly sponsored by CA Technologies. Learn from expert microservices and API presentations at the Modernizing Application Architectures Virtual Summit Series.

Topics:
raml ,api ,integration ,restful ,tutorial

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}