SlideShare a Scribd company logo
1 of 17
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
• 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

What's hot

Creating APIs over RDF
Creating APIs over RDFCreating APIs over RDF
Creating APIs over RDFLeigh Dodds
 
CakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIsCakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIsanthony_putignano
 
Ember.js Self Defining Apps
Ember.js Self Defining AppsEmber.js Self Defining Apps
Ember.js Self Defining AppsOli Griffiths
 
RESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based KatharsisRESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based KatharsisKeith Moore
 
Making the Most of Modern PHP in Drupal 7
Making the Most of Modern PHP in Drupal 7Making the Most of Modern PHP in Drupal 7
Making the Most of Modern PHP in Drupal 7Ryan Szrama
 
Request-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails AppRequest-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails AppNathalie Steinmetz
 
Skillwise - Advanced web application development
Skillwise - Advanced web application developmentSkillwise - Advanced web application development
Skillwise - Advanced web application developmentSkillwise Group
 
OData RESTful implementation
OData RESTful implementationOData RESTful implementation
OData RESTful implementationHari Wiz
 
Working with solr.pptx
Working with solr.pptxWorking with solr.pptx
Working with solr.pptxalignminds
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSCarol McDonald
 

What's hot (18)

Creating APIs over RDF
Creating APIs over RDFCreating APIs over RDF
Creating APIs over RDF
 
Apache solr
Apache solrApache solr
Apache solr
 
Apex code (Salesforce)
Apex code (Salesforce)Apex code (Salesforce)
Apex code (Salesforce)
 
CakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIsCakeFest 2013 - A-Z REST APIs
CakeFest 2013 - A-Z REST APIs
 
Ember.js Self Defining Apps
Ember.js Self Defining AppsEmber.js Self Defining Apps
Ember.js Self Defining Apps
 
CakePHP REST Plugin
CakePHP REST PluginCakePHP REST Plugin
CakePHP REST Plugin
 
RESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based KatharsisRESTful HATEOAS standards using Java based Katharsis
RESTful HATEOAS standards using Java based Katharsis
 
Making the Most of Modern PHP in Drupal 7
Making the Most of Modern PHP in Drupal 7Making the Most of Modern PHP in Drupal 7
Making the Most of Modern PHP in Drupal 7
 
Intro to php
Intro to phpIntro to php
Intro to php
 
Request-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails AppRequest-Response Cycle of Ruby on Rails App
Request-Response Cycle of Ruby on Rails App
 
Skillwise - Advanced web application development
Skillwise - Advanced web application developmentSkillwise - Advanced web application development
Skillwise - Advanced web application development
 
OData RESTful implementation
OData RESTful implementationOData RESTful implementation
OData RESTful implementation
 
Working with solr.pptx
Working with solr.pptxWorking with solr.pptx
Working with solr.pptx
 
Asp.net
Asp.netAsp.net
Asp.net
 
RESTful Web Services with JAX-RS
RESTful Web Services with JAX-RSRESTful Web Services with JAX-RS
RESTful Web Services with JAX-RS
 
Insight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FPInsight into java 1.8, OOP VS FP
Insight into java 1.8, OOP VS FP
 
12 Introduction to Rails
12 Introduction to Rails12 Introduction to Rails
12 Introduction to Rails
 
JSP Part 2
JSP Part 2JSP Part 2
JSP Part 2
 

Similar to Mule soft RAML API Designing

Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIsamesar0
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service BIOVIA
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API RecommendationsJeelani Shaik
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP TutorialLorna Mitchell
 
restapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdfrestapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdfmrle7
 
Rest API Testing
Rest API TestingRest API Testing
Rest API Testingupadhyay_25
 
Basic auth implementation using raml in mule
Basic auth implementation using raml in muleBasic auth implementation using raml in mule
Basic auth implementation using raml in muleAdithya Kuchan
 
Ei cakephp
Ei cakephpEi cakephp
Ei cakephpeiei lay
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debateRestlet
 
Api design and development
Api design and developmentApi design and development
Api design and developmentoquidave
 
Solr Recipes Workshop
Solr Recipes WorkshopSolr Recipes Workshop
Solr Recipes WorkshopErik Hatcher
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service DesignLorna Mitchell
 
API Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNGAPI Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNGSiddharth Sharma
 

Similar to Mule soft RAML API Designing (20)

Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Rest APIs Training
Rest APIs TrainingRest APIs Training
Rest APIs Training
 
Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIs
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service
 
API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
restapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdfrestapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdf
 
Rest API Testing
Rest API TestingRest API Testing
Rest API Testing
 
Basic auth implementation using raml in mule
Basic auth implementation using raml in muleBasic auth implementation using raml in mule
Basic auth implementation using raml in mule
 
Ei cakephp
Ei cakephpEi cakephp
Ei cakephp
 
Cakeph pppt
Cakeph ppptCakeph pppt
Cakeph pppt
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debate
 
RESTful Services
RESTful ServicesRESTful Services
RESTful Services
 
Api design and development
Api design and developmentApi design and development
Api design and development
 
Solr Recipes Workshop
Solr Recipes WorkshopSolr Recipes Workshop
Solr Recipes Workshop
 
Best Practices in Web Service Design
Best Practices in Web Service DesignBest Practices in Web Service Design
Best Practices in Web Service Design
 
API Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNGAPI Testing Using REST Assured with TestNG
API Testing Using REST Assured with TestNG
 

Recently uploaded

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 

Recently uploaded (20)

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 

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 • }
  • 13.
  • 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

  1. /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
  2. /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 }