What is RESTful API?

The importance of APIs in today’s applications is undisputed. An application without an API is like a computer without an internet connection. And as a matter of fact, everything evolves for a while to form common standards and for APIs, it is RESTful.

Although there are now a lot of articles about RESTful API, but I still want to write about this issue to contribute a part of my opinion in RESTful API design. This article is also the knowledge I have learned by myself, refer to many sources, if I have made any mistakes, please give me more suggestions to help me. Thank you

its components

An API (Application Programming Interface) is a set of rules and mechanisms by which an application or component interacts with another application or component. The API can return the data you need for your application in common data types like JSON or XML.

Watching: What is Rest

REST (REpresentational State** T**transfer) is a form of data structure transformation, an architectural style for writing APIs. It uses simple HTTP methods to facilitate machine-to-machine communication. So, instead of using a URL for handling some user information, REST sends an HTTP request like GET, POST, DELETE, etc. to a URL to process the data.

RESTful API is a standard used in the design of APIs for web applications to manage resources. RESTful is one of the popular API design styles used today to let different applications (web, mobile…) communicate with each other.

The most important function of REST is to specify how to use HTTP methods (such as GET, POST, PUT, DELETE…) and how to format URLs for web applications to manage resources. RESTful does not prescribe application code logic and is not limited by application programming languages, any language or framework can be used to design a RESTful API.

READ MORE  Meaning Of The Word Kkk

RESTful API how

?After we know what RESTful API is, in this section we will learn how it works. Like other communication protocols or data structures. To understand the nature of the problem, first of all, it is necessary to understand how it works.

See also: What is Hosting – Web General Knowledge

REST works mainly on the HTTP protocol. The above basic operations will use their own HTTP methods.

GET (SELECT): Returns a Resource or a list of Resource.POST (CREATE): Create a new Resource.PUT (UPDATE): Update information for Resource.DELETE (DELETE): Delete a Resource.

These methods or operations are often called CRUD corresponding to Create, Read, Update, Delete – Create, Read, Edit, Delete.

See also: What is personification – There are several types of personification and examples

Currently, most programmers who write RESTful APIs now choose JSON as the official format, but there are also many people who choose XML as the format, in general, it’s easy and fast to use anyway.

Authentication request and returned data structure

RESTful API does not use sessions and cookies, it uses an access_token for each request. You can learn JWT (JsonWebToken) to know better. I will do a post about JWT in the next part

Some of the main advantages of using the RESTFUL API are:

Make the application clearer REST URLs represent resources, not actionsData are returned in many different formats such as: xml, html, json….Simple and concise code REST focuses on system resources

Websites these days often use REST APIs to allow connections to their data. In it, facebook also provides REST APIs to help external applications connect to their data

READ MORE  45 Content Marketing Trends 2021


Thank you for reading this far, hope it helps a little for those who are new to RESTful API. In the next post, I will build a RESTful API app with Ruby on Rails, see you next time. Thank you again