What is Restful API | Restful API example | Rest Api | Tutorial
Restful Api full form :
What's an API?
An API(Application Programming Interface) is set of definitions for building & application software, it enables different programs to communicate with each other smoothly.
In simple words, if we want to interact with computer or server to retrieve some information, an API helps in communicating to get what we want.
An API can be seen as a mediator between client & use. It also provides way for organizations to share resource and information.
What's is REST API?
State representation can be in JSON, XML, or HTML format Cred:seobility |
RESTful web services are very popular because they are light weight, highly scalable and maintainable and are very commonly used to create APIs for web-based applications.
How does a REST API Work?
Here, every URL is called as a request, and the data which is returned back is called Response, which together is known as Request-Response Model.
Generally, REST API breaks the request into call components. A request is sent to server from client, and response in form of like HTML, XML, or JSON.
Usually developers prefer JSON as a form of response. In HTTP we have 5 general methods for REST API for CRUD operations.
CRUD- Create, Read, Update, Delete
Here are they-
1. GET: This method is used to retrieve/read. Here GET method returns XML/JSON with HTTP response code 200 for successful, 404 for NOT found, 400 for Bad Request.
2. POST: This is used to create new resource. Generally for creation of subordinate resources(for parent). It returns 201 for successfully completing the task.
3. PUT: This is used for updating section. Sometimes used to create new resource too. On successful completion returns 200 & 204 if not returning any content in body. PUT is not considered safe operation but it is idempotent.
4. PATCH: This is used to modifying capabilities. It only needs to contain the changes to resource instead of complete resource.
5. DELETE: As per name this is used to delete a resource by Identity as URL. On successful deletion returns 200 with response body.
Restful API general terms explained:
RESOURCE:
A resource can be any object the API can offer info about. For instance, in the case of a Twitter API, a resource can be a user, hashtag, or any media type like a picture. Every resource has a distinct identifier that can be a name or number.
The resource is the primary abstraction of information in REST. REST API uses a resource identifier to recognize the specific resource involved in the communication between different elements.
SERVER:
A server is any framework that contains assets that the client needs. Whenever it gets client demands, it gives the substance to the client utilizing the API interface. The server will just concede a delegate condition of the source and not complete admittance to the client.
A brilliant illustration of this is the point at which a portable application shows YouTube recordings through its connection point. It utilizes a REST API to call the video content from YouTube without facilitating it on its framework.
Restful API Design Principles:
This REST standard chips away at the idea that client and server ought to be disconnected from each other and allowed to autonomously create. Thusly, you can further develop sensibility across various stages and increment adaptability by smoothing out server parts as UI concerns are discrete from the information stockpiling concerns.
STATELESS:
As per this REST principle, APIs are stateless, which means calls can be made independent of one another. Moreover, every call includes the data essential to complete itself effectively.
In other words, every request sent from the client to the server must include all the info needed to comprehend the request.
Conclusion:
So, this was the brief intro to RESTful API, REST API tutorial, RESTful API tutorial by TechTalkBot.
Hope You like it, similarly for intro to Microservices checkout below link:
If you are also keen to learn Blogging and are new to Blogging world do check out these links also
Common Blogging Mistakes to avoid
Keep reading!
Stay Connected!