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

SnapLogic is the leading self-service enterprise-grade integration platform. Download the 2018 GartnerMagic Quadrant for Enterprise iPaaS or play around on the platform, risk free, for 30 days.

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.

With SnapLogic’s integration platform you can save millions of dollars, increase integrator productivity by 5X, and reduce integration time to value by 90%. Sign up for our risk-free 30-day trial!

Topics:
raml ,api ,integration ,restful ,tutorial

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}