For BE/B.Tech/BCA/MCA/ME/M.Tech Major/Minor Project for CS/IT branch at minimum price Text Message @ 9424820157

RAML (RESTful API Modelling Language) 1.0 Basic Example

  RAML (RESTful API Modelling Language) 1.0 Basic Example





RAML 1.0

RAML stands for RESTful API Modelling Language.We can make RAML for following purposes :

1. It is basically an api specification.
2. If api A is consumed by api B then it is standard contract between these two apis.
3. It is also serves as api documentation.
4. We can mock or api by raml.
5. We can generate api interfaces by using raml.

So we should make a good raml to specify all the required things between the apis.

for making RAML we need to log in to anypoint platform.There we have to go to Design Center.In Design Center create new file as shown below :




Below is the example of a simple raml api specification.This api is performing CRUD operations in a table of employee database.


  • first line is raml version which is 1.0
  • second line is title of api which Employee API
  • v1 is api version
  • /person is resource name which is common for all operations(CRUD).
  • get,post,put,delete are http methods.
  • we can give description of any operation,api,etc.Here we are using description under http method so it gives description of operation perform by http method.
  • displayName is name of resource which is used in api.
  • responses contains response attributes like http server code,body,response format,examples,etc.
  • under response we can define http server code like 200,201,etc.
  • under response, body attribute defines response body.
  • we can define response format also which is application/json in our api.
  • example is the actual output response.

Once RAML is completed we can download it and import it into our project in src/main/resources in anypoint 7 or src/main/api in anypoint 6. 

We can also directly connect with anypoint platform by API sync in anypoint studio.



#%RAML 1.0 title: Employee API
version: v1 /person: get: description: get data of all persons displayName: person responses: 200: body: application/json: example: [{ "id" : 1, "firstName" : "Rahul", "lastName" : "Singh", "city" : "Mumbai" }] post: description: insert data of persons displayName: person responses: 201: body: application/json: example: { "data" : "Data is inserted successfully" } put: description: update data of persons displayName: person responses: 204: body: application/json: example: { "data" : "Data is updated successfully" } delete: description: delete data of persons displayName: person responses: 200: body: application/json: example: { "data" : "Data is deleted successfully" }

1 comment:

  1. I will prefer this blog because it has much more informative stuff. This is really good. Visit Google Search Api for more related information and knowledge.

    ReplyDelete



Please go through below tutorials:


Mule 4 Tutorials

DEPLOY TO CLOUDHUB C4E CLIENT ID ENFORCEMENT CUSTOM POLICY RABBIT MQ INTEGRATION
XML TO JSON WEBSERVICE CONSUMER VM CONNECTOR VALIDATION UNTIL SUCCESSFUL
SUB FLOW SET & REMOVE VARIABLE TRANSACTION ID SCATTER GATHER ROUND ROBIN
CONSUME REST WEBSERVICE CRUD OPERATIONS PARSE TEMPLATE OBJECT TO JSON LOAD STATIC RESOURCE
JSON TO XML INVOKE IDEMPOTENT FILTER FOR EACH FLAT TO JSON
FIXWIDTH TO JSON FIRST SUCCESSFUL FILE OPERATIONS EXECUTE ERROR HANDLING
EMAIL FUNCTIONALITY DYNAMIC EVALUATE CUSTOM BUSINESS EVENT CSV TO JSON COPYBOOK TO JSON
CHOICE ASYNC

Widely used Connectors in Mule 3

CMIS JETTY VM CONNECTOR SALESFORCE POP3
JMS TCP/IP WEBSERVICE CONSUMER QUARTZ MONGO DB
FILE CONNECTOR DATABASE CONNECTOR


Widely used Scopes in Mule 3

SUB FLOW REQUEST REPLY PROCESSOR CHAIN FOR EACH CACHE
ASYNC TCP/IP COMPOSITE SOURCE POLL UNTIL SUCCESSFUL
TRANSACTIONAL FLOW

Widely used Components in Mule 3

EXPRESSION CXF SCRIPT RUBY PYTHON
JAVASCRIPT JAVA INVOKE CUSTOM BUSINESS EVENT GROOVY
ECHO LOGGER


Widely used Transformers in Mule 3

MONGO DB XSLT TRANSFORMER REFERENCE SCRIPT RUBY
PYTHON MESSAGE PROPERTIES JAVA TRANSFORMER GZIP COMPRESS/UNCOMPRESS GROOVY
EXPRESSION DOM TO XML STRING VALIDATION COMBINE COLLECTIONS BYTE ARRAY TO STRING
ATTACHMENT TRANSFORMER FILE TO STRING XML TO DOM APPEND STRING JAVASCRIPT
JSON TO JAVA COPYBOOK TO JSON MAP TO JSON JSON TO XML FLATFILE TO JSON
FIXWIDTH TO JSON CSV TO JSON


Widely used Filters in Mule 3

WILDCARD SCHEMA VALIDATION REGEX PAYLOAD OR
NOT MESSAGE PROPERTY MESSAGE IDEMPOTENT FILTER REFERNCE
EXPRESSION EXCEPTION CUSTOM AND


Exception Strategy in Mule 3

REFERENCE EXCEPTION STRATEGY CUSTOM EXCEPTION STRATEGY CHOICE EXCEPTION STRATEGY CATCH EXCEPTION STRATEGY GLOBAL EXCEPTION STRATEGY


Flow Control in Mule 3

CHOICE COLLECTION AGGREGATOR COLLECTION SPLITTER CUSTOM AGGREGATOR FIRST SUCCESSFUL
MESSAGE CHUNK AGGREGATOR MESSAGE CHUNK SPLITTER RESEQUENCER ROUND ROBIN SOAP ROUTER