The document provides an agenda for an API design meetup using the RESTful API Modeling Language (RAML). The agenda includes introductions, an overview of RAML basics like resource modeling and HTTP methods/status codes, demonstrations of RAML features like examples, data types, traits, security schemes and more. It also mentions a Q&A session and trivia quiz at the end. Attendees are encouraged to provide feedback through a form after the meetup.
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
Engineering Student MuleSoft Meetup#2 - API Design Using Restful API Modeling Language (RAML)
1. 08th Jan 2022
11:00 IST (GMT+05:30)
Engineering Student MuleSoft Meetup Group
API DESIGN USING RESTFUL API MODELING
LANGUAGE (RAML)
2. Safe Harbour Statement
● Both the speaker and the host are organizing this meet-up in individual capacity only. We are not
representing our companies here.
● This presentation is strictly for learning purposes only. Organizer/Presenter do not hold any
responsibility that same solution will work for your business requirements.
● This presentation is not meant for any promotional activities.
2
3. A recording of this meetup will be uploaded to events page within 24 hours.
Questions can be submitted/asked at any time in the Chat/Questions & Answers Tab.
Make it more Interactive!!!
Give us feedback! Rate this meetup session by filling feedback form at the end of the day.
We Love Feedbacks!!! Its Bread & Butter for Meetup.
Housekeeping
3
9. 9
RAML Basics
Stands for RESTful API Modeling
Language
Language to define specification for HTTP
based APIs
Based on YAML
Used to create a mutual
contract between API
Consumer and API
provider which defines
Resource(s)
Request
Response
Security
10. 10
Query Params and URI Params
Query Params URI Params
Used to sort/ filter on a given set of resource (records) Used to access a specific resource (record)
Example:
Find employees whose designation are workers.
Example:
Find distinct employee from employee database, using
employeeId.
https://www.abcbak.com/employees?designation=worker
https://www.abcbank.com/employees?key=value
Accessed using question mark ? and ampersand &
https://www.abcbak.com/employees/12345
https://www.abcbank.com/employees/{employeeId}
Accessed using curly braces {}
11. 11
HTTP Methods and Response Codes
HTTP Methods Description Example Response Code
GET Fetch resources (records) from a given set
of resource
Fetch employees from employee
database
200
POST Create a new resource (record) in a given
set of resource
Insert a new employee in employee
database
201
PUT Create or Update an existing/ new
resource
Updating an employee details 200/ 201
PATCH Update an existing resource (record) Updating an employee salary 200
DELETE Delete an existing resource (record) Deleting an employee 200
HTTP Response Status Codes
Informational responses 1xx 100-199
Successful responses 2xx 200-299
Redirection messages 3xx 300-399
Client error responses 4xx 400-499
Server error responses 5xx 500-599
HTTP Error Response Status Codes
401 Unauthorized
404 Not Found
500 Internal Server Error
502 Bad Gateway
503 Service Unavailable
13. 13
Design Center Navigation
● Sign up for a 30 days free trial Anypoint Platform account
https://anypoint.mulesoft.com/login/signup or just follow https://docs.mulesoft.com/access-
management/managing-your-account
● Login to your account and click on three dashes on extreme up left on home page to show
options.
1
2
14. 14
Examples
Examples are dummy responses across your API HTTP methods. For example: Success response, error
response etc.
RAML
Based
JSON
Based
Usage
15. 15
Data Types
● Data types are used for describing data for its validation against type declaration.
● Example:
○ employeeId should be of integer type
○ employeeName should be of string type
16. 16
Traits
Traits are reusable components to help define common attributes for HTTP methods such as cacheable,
filterable, searchable, pageable etc.
Apart from serving above purpose, A trait can be designed for almost each and every feature such as a
response, queryParams, headers etc.
Define
Include
Use
17. 17
Security Schemes
It is a mechanism to secure data access, identify requests, and determine access level and data visibility
at resource, method or even root RAML file level
Type Description
OAuth 1.0 The API authentication requires using OAuth 1.0 as described in RFC5849
OAuth 2.0 The API authentication requires using OAuth 2.0 as described in RFC6749
Basic Authentication
The API authentication relies on using Basic Access Authentication as described
in RFC2617
Digest Authentication
The API authentication relies on using Digest Access Authentication as described
in RFC2617
Pass Through
Headers or query parameters are passed through to the API based on a defined
mapping.
x-{other} The API authentication relies on another authentication method.
18. 18
Resource Types
Resource types help to reduce/ eliminate frequent repetitive declarations of resources, methods etc. by
using dynamic placeholders.
● Used to define reusable patterns for
○ Resources
○ Methods
● Advantages
○ Consistency
○ Reduces complexity
○ Less code
19. 19
Library
● RAML libraries are used to combine any collection of
○ Data type
○ Resource type
○ Trait
○ Security scheme
into modular, externalized, reusable groups.
It can be defined as an external library and can be included in wherever required.
20. 20
Fragments
Reusable RAML documents/ snippets that can be used across API Specs as dependencies from Anypoint
Exchange or external file/ folder. A fragment is an independent component that can be created and
published on Anypoint Exchange.
• Trait
• Resource Type
• Library
• Type
• User Documentation
• Example
• Annotation Type
• Security Scheme
23. 23
Question 1
RAML Stands for
A. RESTful API Modeling Language
B. Reserved API Modeling Language
C. Routing API Modeling Language
D. ReactJS API Modeling Language
24. 24
Question 2
Which parameter is most suitable and standard way to access a specific/ distinct resource (record) from a
collections of resources.
A. Query Parameter (?key=value)
B. URI Parameter (/{})
25. 25
Question 3
Which of below is correct option to use example(s) from examples folder in a root RAML file
A. #import examples/employeeExamples.raml
B. #include examples/employeeExamples.raml
C. !include examples/employeeExamples.raml
D. @use examples/employeeExamples.raml
26. 26
Question 4
A Fragment can be published/ deployed to Anypoint Exchange independently without being included in
Any API Specification.
A. True
B. False
27. 27
Bonus question
Did you enjoy today’s session?
Drop a feedback once you receive an official email after this meetup. Also, Send us a note on LinkedIn.