@hb_mulesoftTechworld
In this session you will learn what is REST API, RAML and what is the use of Design first approach, and you will create First API schema using Anypoint platform Design center
Session Content
=============
What is RAML?
============
RESTFul API Modelling Language
REST - Representational State Transfer
API - Application Programming Interface
URI - Uniform Resource Indicator
URL - Uniform Resource Locator
HTTP - Hyper Text Transfer Portocol
HTML - Hyper Text Markup Langauge
REST API is an programming interface (API or Web API), which will expose the resources or information of records from
providers/producers (who provides response) to
consumers (Who submits requests and receives response)
RESP API is architectural style, in order to develop an REST API it needs to follow certain rules.
1. Uniform Interface
a. Hides the complexcity of system architecture
b. Identification of resources
c. easy to understand responses or messages
d. Hypermedia as the engine of application state – The client should have only the initial URI of the application. The client application should dynamically drive all other resources and interactions with the use of hyperlinks.
2. Stateless
a. The requests should be seaprated with all the necessary information.
b. The response of one request need not be dependent on other request.
3. Client-Server
This design pattern separated the concerns of Client and Server systems (application to application dependencies)
So, the systems in orgainizations can evolve independently.
We need to make sure the interface communication/contract is not broken , by providing the upto date resources / functionality
4. Layered system
5. Cacheable
6. Code on demand
What is Resource?
It is main abstract of information in REST is a resource. Any info that we can name can be a resource.
eg: employees, orders, suppliers
The state of the resource at any point of time is called as resource representation.
data, metadata, hypermedia links
Data - Employees data
Meta data - Data of Data (query parameter dept 10)
"empDetails":{
"ename": "Chandra",
"empId": 101,
"links": [
{
"updateEmployee": {"method": "PATCH", "responseFormat": "json", "url": "http://host:port/employees/{empId}" }
}
]
}
Hypermedia/mimetype
The format of request or response to be processed by resource.
JSON (Javascript Object Notation)
XML
TEXT
HTML
CSV
Resouce Methods/Verbs
Regularly used: GET, POST, PUT, PATCH, DELETE
Others: OPTIONS, HEAD