What is the REST API in web development
Definition and functioning
API is the acronym for "Application Programming Interface". This is a software intermediary that allows two applications to communicate with one another on the web and on end devices. An API is used every time users use an app like Facebook or check the weather on their smartphone.
The abbreviation REST stands for "Representational State Transfer" and describes an architecture model. The architecture of a REST API is based on six principles that describe how networked resources on the web, for example in a cloud, are defined and addressed. These principles were described in 2000 by Roy Fielding as part of his dissertation "Architectural Styles and the Design of Network-based Software Architectures". The principle of statelessness is essential for a REST API. This means that every REST message contains all information that is necessary to understand this message. REST is not a programming language or basic structure, or software that can be executed.
RESTful APIs use the HTTP request methods GET, POST, PUT and DELETE defined in RFC 2616. So that client and server can communicate with each other, no protocol conventions are required for REST APIs. GET is used to request resources from the RESTful API. POST is used to update or change the state of a resource. With PUT, new resources can be created or the content of existing resources can be replaced. DELETE is used to delete resources. These four HTTP methods are usually sufficient to cover most use cases.
Origin and development of REST APIs
REST is an alternative to methods such as SOAP (Simple Object Access Protocol) and WSDL (Web Services Description Language). The architecture model was developed towards the end of the 1990s and fundamentally changed the API landscape. The first companies to use a REST API were Ebay and Amazon. Access to the easy to use and well documented eBay REST API was offered to a selection of partners. As a result, the eBay marketplace was no longer only accessible to direct visitors to the Ebay platform, but via every website that accessed the eBay API.
Flickr also launched its own REST API in 2004, just in time for the rise of social networks and blogs on the web. Flickr paved the way for social sharing, which Facebook and Twitter later joined.
In 2006 Amazon contributed to the development of the cloud with its REST API, which is now widely used. RESTful APIs enable users to connect to the cloud and interact with cloud services. They are now used by many websites and are considered the backbone of the web.
The six principles of the REST architecture
The principle behind the client-server architecture is to separate problems. The segregation of the user interface from the data storage improves the portability of the user interface across multiple platforms. For the web it is important that the separation allows the components to be developed independently of one another.
Statelessness means that the communication between the client and the server always contains all the information that is needed to execute the request. There is no session state on the server, it is kept entirely on the client side. If access to a resource requires authentication, the client must authenticate itself with every request.
The client, server, and any components in between can all cache resources to improve performance. The information can be classified as cacheable or non-cacheable.
In order for the components of a REST API to be able to communicate with one another, they must follow the same rules. This also makes it easier to understand the interactions between the various components of the system.
Individual components cannot see beyond the immediate plane with which they interact. This means that a client connecting to an intermediate component such as a proxy has no knowledge of what is behind it. This enables components to be independent of one another and thus easily exchangeable or expandable.
Code on demand
Additional code can be downloaded to extend the client functionality. However, this is optional because the client may not be able to download or run this code.
The benefits of REST for developing an API
The complete separation of the user interface of the server and the data store offers several advantages for the development of an API. For example, it improves the portability of the interface to other types of platforms, increases the scalability of the projects and enables the various components to be developed independently of one another. Developers can easily migrate to other servers or make changes to the database, provided that the data is sent correctly from each request. The separation thus increases the overall flexibility in the development.
A REST API is always independent of the type of platform or the languages used, it always adapts to the type of syntax or platform used. This gives you great freedom when changing or testing new environments within a development. PHP, Java, Python or Node.js servers can be used with a REST API. Only the responses to requests always have to be in the language used for the exchange of information, usually XML or JSON.
The lack of standardization can be seen as a disadvantage of REST APIs, which can lead to misunderstandings.
- Thumb sucking is a dangerous habit
- What is a covariance matrix
- Chinese Americans celebrate Chinese festivals
- Why do interviewers ask the most common questions
- Who created AI
- What are some examples of circular permutations
- How can you make money with Darkweb
- How bad is McDonald's food
- Can I drop shipping in Pakistan
- What common convictions do wise minds share?
- What does the Bible say about relationships
- Which country has Instagram developed
- What is a postcard size photo
- Will AI be the future of racism?
- People use coconut oil for lubrication
- What is the common food in Malaysia
- Why are cannabis smokers usually thin?
- Are chia seeds good for weight loss?
- Are Canadians as patriotic as Americans
- Which countries censor the internet the least?
- What is the future of the Malaysian currency
- What are Marketing Tactics
- Is Colonia Doctores in Mexico City safe
- What are the best jobs in the fashion industry
- Is junk DNA what makes people unique
- Can NASA reduce space waste
- How are AAA video games made
- You can eat boiled head of lamb
- Will raising the minimum wage help the economy?
- Network marketing is a simple business
- Are people solar powered
- Can a virgin woman orgasm?
- Can you give me a diet