Friday, August 19, 2022
REST API
REpresentational State Transfer Application Programming Interface.
refers to a group of software architecture design constraints that bring about efficient, reliable, and scalable systems.
it is a data architecture and design methodology that produces predicatable and consistent behaviours and ouputs by receiving a set of standard methods called verbs and returning standarized structured data, typically JSON or XML, called the resource.
API is a set of features and rules that exist inside of a software program enabling interaction between the software and other items, such as other software or hardware. In the context of REST APIs, The API is the collection of tools used to access and work with REST resources through your adverbs including get, pulls,put, and delete.
URL vs URI vs URN
------------------
URL --> Actual physical location.
URI vs URL --> All URLs are URIs and not All URIs are URLs.
URN --> is a subset of URI. Unique name identifier , say a person.
A URN can also be a URL, but doesn't have to be . So in conclusion a URL might also be a URN and both are URIs.
The Six Constraints of REST
---------------------------
1) Client-Server Architecture : The client manages user interface concerns while the server manages data storage concerns.
2) Statelessness : No client context or information , aka "state" , can be stored on the server between requests.
3) Cacheability : All REST responses must be clearly marked as cacheable or not cacheable.
4) Layered System: The client cannot know , and shouldn't care, whether it's connected directly to the server or to an intermediary like a CDN or mirror.
5) Code on Demand: servers are allowed to transfer executable code like client side JavaScript and compiled components to clients.
6) Uniform Interface:
6.1 : Resource identification in requests: The URI request must specify what resource it is looking for and what format thte response should use.
6.2 : Resource manipulation through representations: Once a client has a representation of a resource, it can modify or delete the resource.
6.3 : Self-descriptive messages: A unform interface must issue self-descriptive messages. This goes to both sending and receiving REST data. Each representation must describe its own data format.
6.4 : Hypermedia as the engine of application state: Once a client has access to a REST service, it should be able to discover al available resources and methods through the hyperlinks provided.
Humans are not directly interacting with the REST API, Communication with the REST API is handled by the client, which can be anything , really. A website, an app, even an internet of things device.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment