SlideShare a Scribd company logo
API
RAML API Designing Basics
• Introduction
• RAML API Schema
• Root
• Resources
• Methods
• URI Parameters
• Query Parameters
• Responses
Introduction
What is RAML ?
• RAML : RESTful API Modeling Language.
• Non-proprietary, vendor-neutral open spec.
• Aims to help current API ecosystem and solve immediate problems,
and then gently encourage ever-better API patterns.
Why RAML ?
• Makes it easy to manage the whole API lifecycle from design to
sharing.
• Concise - you only write what you need to define.
• Reusable.
• Machine readable API design that is actually human friendly.
API Schema
Root
• Some basic information about the API. i.e. title, baseUri, version etc.
Resources
• Decides how API can be used by consumers.
Methods
• To define what consumers can do with the resources.
URI Parameters
• To have dynamic resources, to act upon the more granular objects of
the resources.
Query Parameters
• To be passed to methods, to extend the functionality of the API.
Responses
• HTTP status codes, may include descriptions, examples or schemas
Root
• Contains Some basic information about the API. i.e. title, baseUri,
version etc.
• Everything entered in at the root (or top) of the spec applies to the rest
of the API.
• Chosen baseURI will be used with every call made, hence make sure to
keep it clean and concise.
Example :
• #%RAML 0.8
• title: Employee Details Management
• version: v1
• baseUri:
https://mocksvc.mulesoft.com/mocks/c2a7ecf4-edd3-
4023-8373-c3a2cf325dda/api/{version}
Resources
• Decides how API can be used by consumers.
• Resources always begin with a slash ( / ) in RAML.
• Any methods and parameters nested under these top level resources
belong to and act upon that resource.
• Nesting of resources is also possible.
Example :
• /employees:
• /department:
• /region:
Methods
• To define what consumers can do with the resources.
• Most common HTTP methods :
• get : Retrieve the information defined in the request URI.
• put : Replace the addressed collection. At the object-level, create or update
it.
• post : Create a new entry in the collection. This method is generally not
used at the object-level.
• delete : Delete the information defined in the request URI.
• Each HTTP method can only be used once per resource.
• Lower case must be used for methods in RAML API definition.
Example :
• /employees:
• get:
• post:
• put:
delete:
URI Parameters
• To have dynamic resources, to act upon the more granular objects of
the resources.
• Used for nesting of resources.
• A URI parameter is denoted by surrounding curly brackets in RAML.
Example :
• /employees:
• /{employeeName}:
• With above, to make a request to this nested resource, the URI for the
employee, ‘Thomas Anderson’ would look like
– http://api.EmpolyeeDet.com/v1/ employees/ Thomas Anderson
Query Parameters
• To be passed to methods, to extend the functionality of the API.
• To make developers to be able to perform more powerful actions, like
filtering a collection based on passed parameters.
• Query parameters may also be something that the server requires to
process the API consumer's request, like an access token.
Example :
• / employees :
• /{employeeName}
• get:
• queryParameters:
• employeeId :
• put:
• queryParameters:
• access_token:
Continue…
• Each query parameter may have any number of optional attributes to
further define it.
• Example :
• / employees :
• /{employeeName}
• get:
• queryParameters:
• employeeId :
• displayName: Employee Id
• type: string
• description: Id of an employee
• example: E001
• required: false
Responses
• A map of one or more HTTP status codes.
• Each response may include descriptions, examples or schemas
• Note the pipe ( | ) after ‘example’ keyword, it’s to indicate what follows
is a string, if not put, it’ll give an error saying, ‘example must be a
string’.
Example :
• / employees :
• /{employeeName}:
• get:
• description: Retrieves details of a specific employee
• responses:
• 200:
• body:
• application/json:
• example: |
• {
• …<sample data>
• },
• "success": true,
• "status": 200
• }
Example
Mule soft RAML API Designing
• The main flow for a RAML-based API manages these functions:
• Exposes the API using HTTP or Jetty.
• Routes requests between the interface and the backend flows based on
the HTTP request.
• References exception strategies that produce HTTP-status-code responses.
Main Flow
Backend Flows
• APIkit generates a backend flow for each resource-action pairing in a
RAML. APIkit for SOAP generates a backend flow for each operation in a
WSDL. For example, the RAML interface receives the GET request for sales
of T-shirts. The backend flow accesses a database to look up sales data
and responds to the request.
Flights API
API
United
American
Delta
Front-end
UI
Mule ESB
Connection Details
United Airlines: RESTful web service
• URL: http://mu.mulesoft-training.com/essentials/united/flights
Delta Airlines: web service• URL:
• URL: http://mu.mulesoft-training.com/essentials/delta
American Airlines: MySQL database
• Server: mudb.mulesoft-training.com
• Port: 3306
• User: mule
• Password: mule
• Database: training
• American table: flights

More Related Content

PDF
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India
 
PPTX
Design API using RAML - basics
kunal vishe
 
PPTX
Rest and Sling Resolution
DEEPAK KHETAWAT
 
PPTX
Slim Framework
Pramod Raghav
 
PPTX
Searching in AtoM
Artefactual Systems - AtoM
 
PPTX
REST-API's for architects and managers
Patrick Savalle
 
PPT
What Is Hobo ?
Evarist Lobo
 
PPTX
REST-API introduction for developers
Patrick Savalle
 
Eclipse Day India 2015 - Rest with Java (jax rs) and jersey
Eclipse Day India
 
Design API using RAML - basics
kunal vishe
 
Rest and Sling Resolution
DEEPAK KHETAWAT
 
Slim Framework
Pramod Raghav
 
Searching in AtoM
Artefactual Systems - AtoM
 
REST-API's for architects and managers
Patrick Savalle
 
What Is Hobo ?
Evarist Lobo
 
REST-API introduction for developers
Patrick Savalle
 

What's hot (18)

ODP
Creating APIs over RDF
Leigh Dodds
 
PPTX
Apache solr
Dipen Rangwani
 
PPTX
Apex code (Salesforce)
Mohammed Safwat Abu Kwaik
 
PPTX
CakeFest 2013 - A-Z REST APIs
anthony_putignano
 
PDF
Ember.js Self Defining Apps
Oli Griffiths
 
KEY
CakePHP REST Plugin
Kevin van Zonneveld
 
PDF
RESTful HATEOAS standards using Java based Katharsis
Keith Moore
 
PDF
Making the Most of Modern PHP in Drupal 7
Ryan Szrama
 
PPTX
Intro to php
NithyaNithyav
 
PDF
Request-Response Cycle of Ruby on Rails App
Nathalie Steinmetz
 
PPTX
Skillwise - Advanced web application development
Skillwise Group
 
PPTX
OData RESTful implementation
Hari Wiz
 
PPT
Working with solr.pptx
alignminds
 
PPTX
Asp.net
Anchit Rajawat
 
ODP
RESTful Web Services with JAX-RS
Carol McDonald
 
PPTX
Insight into java 1.8, OOP VS FP
Syed Awais Mazhar Bukhari
 
PPTX
12 Introduction to Rails
Deepak Hagadur Bheemaraju
 
PPT
JSP Part 2
DeeptiJava
 
Creating APIs over RDF
Leigh Dodds
 
Apache solr
Dipen Rangwani
 
Apex code (Salesforce)
Mohammed Safwat Abu Kwaik
 
CakeFest 2013 - A-Z REST APIs
anthony_putignano
 
Ember.js Self Defining Apps
Oli Griffiths
 
CakePHP REST Plugin
Kevin van Zonneveld
 
RESTful HATEOAS standards using Java based Katharsis
Keith Moore
 
Making the Most of Modern PHP in Drupal 7
Ryan Szrama
 
Intro to php
NithyaNithyav
 
Request-Response Cycle of Ruby on Rails App
Nathalie Steinmetz
 
Skillwise - Advanced web application development
Skillwise Group
 
OData RESTful implementation
Hari Wiz
 
Working with solr.pptx
alignminds
 
RESTful Web Services with JAX-RS
Carol McDonald
 
Insight into java 1.8, OOP VS FP
Syed Awais Mazhar Bukhari
 
12 Introduction to Rails
Deepak Hagadur Bheemaraju
 
JSP Part 2
DeeptiJava
 
Ad

Similar to Mule soft RAML API Designing (20)

PDF
RAML
Shanky Gupta
 
PPTX
mulesoft birmingham meetup_api_designing_with_raml
mohammadsakifuddin
 
PPTX
The ins and outs of RAML
MuleSoft Meetups
 
PDF
Engineering Student MuleSoft Meetup#2 - API Design Using Restful API Modelin...
Jitendra Bafna
 
PPTX
Faridabad Mulesoft Meetup Oct 10
Amit Singh
 
PPTX
Raml part 1
venkata20k
 
PPTX
Mule raml
Ramakrishna Kapa
 
PPTX
RAML - APIs By Design
Uri Sarid
 
PDF
RAML BASED REST API with Mulesoft anypoint
akshay yeluru
 
PPT
RAML - The architecture
Ankush Sharma
 
PPTX
Rest With Raml
vijay dhanakodi
 
PPT
Raml
Ankush Sharma
 
PDF
ApiAddicts Meetup Sept 2016, Madrid
Christian Heidenreich
 
PPTX
MuleSoft Surat Virtual Meetup#9 - RAML Reusability and Simplified
Jitendra Bafna
 
PPTX
Creating a mule project with raml and api
Bhargav Ranjit
 
PDF
Faridabad MuleSoft Meetup Group (1).pdf
RohitSingh585124
 
PPTX
Mule esb _web_services
Naresh Naidu
 
PPTX
Mule esb whole_web_services
Naresh Naidu
 
PDF
Second meetup slidess
Alan Muñoz Ochoa
 
ODP
Mulesoft Raml APIs
akshay yeluru
 
mulesoft birmingham meetup_api_designing_with_raml
mohammadsakifuddin
 
The ins and outs of RAML
MuleSoft Meetups
 
Engineering Student MuleSoft Meetup#2 - API Design Using Restful API Modelin...
Jitendra Bafna
 
Faridabad Mulesoft Meetup Oct 10
Amit Singh
 
Raml part 1
venkata20k
 
Mule raml
Ramakrishna Kapa
 
RAML - APIs By Design
Uri Sarid
 
RAML BASED REST API with Mulesoft anypoint
akshay yeluru
 
RAML - The architecture
Ankush Sharma
 
Rest With Raml
vijay dhanakodi
 
ApiAddicts Meetup Sept 2016, Madrid
Christian Heidenreich
 
MuleSoft Surat Virtual Meetup#9 - RAML Reusability and Simplified
Jitendra Bafna
 
Creating a mule project with raml and api
Bhargav Ranjit
 
Faridabad MuleSoft Meetup Group (1).pdf
RohitSingh585124
 
Mule esb _web_services
Naresh Naidu
 
Mule esb whole_web_services
Naresh Naidu
 
Second meetup slidess
Alan Muñoz Ochoa
 
Mulesoft Raml APIs
akshay yeluru
 
Ad

Recently uploaded (20)

PPT
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PPTX
Color Model in Textile ( RGB, CMYK).pptx
auladhossain191
 
PDF
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
PPT
SCOPE_~1- technology of green house and poyhouse
bala464780
 
PPTX
Information Retrieval and Extraction - Module 7
premSankar19
 
PDF
Introduction to Data Science: data science process
ShivarkarSandip
 
PDF
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
PDF
Zero Carbon Building Performance standard
BassemOsman1
 
PPTX
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
PDF
Top 10 read articles In Managing Information Technology.pdf
IJMIT JOURNAL
 
PDF
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
PPTX
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
PDF
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
The Asian School
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PPTX
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
PDF
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hatem173148
 
PDF
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 
1. SYSTEMS, ROLES, AND DEVELOPMENT METHODOLOGIES.ppt
zilow058
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
Color Model in Textile ( RGB, CMYK).pptx
auladhossain191
 
FLEX-LNG-Company-Presentation-Nov-2017.pdf
jbloggzs
 
SCOPE_~1- technology of green house and poyhouse
bala464780
 
Information Retrieval and Extraction - Module 7
premSankar19
 
Introduction to Data Science: data science process
ShivarkarSandip
 
Packaging Tips for Stainless Steel Tubes and Pipes
heavymetalsandtubes
 
Zero Carbon Building Performance standard
BassemOsman1
 
database slide on modern techniques for optimizing database queries.pptx
aky52024
 
Top 10 read articles In Managing Information Technology.pdf
IJMIT JOURNAL
 
Biodegradable Plastics: Innovations and Market Potential (www.kiu.ac.ug)
publication11
 
dse_final_merit_2025_26 gtgfffffcjjjuuyy
rushabhjain127
 
Module2 Data Base Design- ER and NF.pptx
gomathisankariv2
 
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
The Asian School
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
Victory Precisions_Supplier Profile.pptx
victoryprecisions199
 
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
hatem173148
 
Chad Ayach - A Versatile Aerospace Professional
Chad Ayach
 

Mule soft RAML API Designing

  • 1. API
  • 2. RAML API Designing Basics • Introduction • RAML API Schema • Root • Resources • Methods • URI Parameters • Query Parameters • Responses
  • 3. Introduction What is RAML ? • RAML : RESTful API Modeling Language. • Non-proprietary, vendor-neutral open spec. • Aims to help current API ecosystem and solve immediate problems, and then gently encourage ever-better API patterns. Why RAML ? • Makes it easy to manage the whole API lifecycle from design to sharing. • Concise - you only write what you need to define. • Reusable. • Machine readable API design that is actually human friendly.
  • 4. API Schema Root • Some basic information about the API. i.e. title, baseUri, version etc. Resources • Decides how API can be used by consumers. Methods • To define what consumers can do with the resources. URI Parameters • To have dynamic resources, to act upon the more granular objects of the resources. Query Parameters • To be passed to methods, to extend the functionality of the API. Responses • HTTP status codes, may include descriptions, examples or schemas
  • 5. Root • Contains Some basic information about the API. i.e. title, baseUri, version etc. • Everything entered in at the root (or top) of the spec applies to the rest of the API. • Chosen baseURI will be used with every call made, hence make sure to keep it clean and concise. Example : • #%RAML 0.8 • title: Employee Details Management • version: v1 • baseUri: https://mocksvc.mulesoft.com/mocks/c2a7ecf4-edd3- 4023-8373-c3a2cf325dda/api/{version}
  • 6. Resources • Decides how API can be used by consumers. • Resources always begin with a slash ( / ) in RAML. • Any methods and parameters nested under these top level resources belong to and act upon that resource. • Nesting of resources is also possible. Example : • /employees: • /department: • /region:
  • 7. Methods • To define what consumers can do with the resources. • Most common HTTP methods : • get : Retrieve the information defined in the request URI. • put : Replace the addressed collection. At the object-level, create or update it. • post : Create a new entry in the collection. This method is generally not used at the object-level. • delete : Delete the information defined in the request URI. • Each HTTP method can only be used once per resource. • Lower case must be used for methods in RAML API definition. Example : • /employees: • get: • post: • put: delete:
  • 8. URI Parameters • To have dynamic resources, to act upon the more granular objects of the resources. • Used for nesting of resources. • A URI parameter is denoted by surrounding curly brackets in RAML. Example : • /employees: • /{employeeName}: • With above, to make a request to this nested resource, the URI for the employee, ‘Thomas Anderson’ would look like – http://api.EmpolyeeDet.com/v1/ employees/ Thomas Anderson
  • 9. Query Parameters • To be passed to methods, to extend the functionality of the API. • To make developers to be able to perform more powerful actions, like filtering a collection based on passed parameters. • Query parameters may also be something that the server requires to process the API consumer's request, like an access token. Example : • / employees : • /{employeeName} • get: • queryParameters: • employeeId : • put: • queryParameters: • access_token:
  • 10. Continue… • Each query parameter may have any number of optional attributes to further define it. • Example : • / employees : • /{employeeName} • get: • queryParameters: • employeeId : • displayName: Employee Id • type: string • description: Id of an employee • example: E001 • required: false
  • 11. Responses • A map of one or more HTTP status codes. • Each response may include descriptions, examples or schemas • Note the pipe ( | ) after ‘example’ keyword, it’s to indicate what follows is a string, if not put, it’ll give an error saying, ‘example must be a string’. Example : • / employees : • /{employeeName}: • get: • description: Retrieves details of a specific employee • responses: • 200: • body: • application/json: • example: | • { • …<sample data> • }, • "success": true, • "status": 200 • }
  • 14. • The main flow for a RAML-based API manages these functions: • Exposes the API using HTTP or Jetty. • Routes requests between the interface and the backend flows based on the HTTP request. • References exception strategies that produce HTTP-status-code responses. Main Flow
  • 15. Backend Flows • APIkit generates a backend flow for each resource-action pairing in a RAML. APIkit for SOAP generates a backend flow for each operation in a WSDL. For example, the RAML interface receives the GET request for sales of T-shirts. The backend flow accesses a database to look up sales data and responds to the request.
  • 17. Connection Details United Airlines: RESTful web service • URL: http://mu.mulesoft-training.com/essentials/united/flights Delta Airlines: web service• URL: • URL: http://mu.mulesoft-training.com/essentials/delta American Airlines: MySQL database • Server: mudb.mulesoft-training.com • Port: 3306 • User: mule • Password: mule • Database: training • American table: flights

Editor's Notes

  • #11: /books: /{bookTitle} get: queryParameters: author: displayName: Author type: string description: An author's full name example: Mary Roach required: false publicationYear: displayName: Pub Year type: number description: The year released for the first time in the US example: 1984 required: false rating: displayName: Rating type: number description: Average rating (1-5) submitted by users example: 3.14 required: false isbn: displayName: ISBN type: string minLength: 10 example: 0321736079? put: queryParameters: access_token: displayName: Access Token type: string description: Token giving you permission to make call required: true
  • #13: /books: /{bookTitle}: get: description: Retrieve a specific book title responses: 200: body: application/json: example: | { "data": { "id": "SbBGk", "title": "Stiff: The Curious Lives of Human Cadavers", "description": null, "datetime": 1341533193, "genre": "science", "author": "Mary Roach", "link": "http://e-bookmobile.com/books/Stiff", }, "success": true, "status": 200 }