REST API Flashcards
WHAT IS REST API
Representational Transfer and Application Programming Interface.
Is REST a specific technology?
REST is not a specific technology, but rather a data architecture and design methodology that produces predictable and consistent outputs and behaviors by receiving a set of standard methods called verbs and returning standardized structured data, typically JSON or XML, called the resource.
What is a URL?
UNIVERSAL RESOURCE LOCATOR
How does a typical website work?
A typical website compromises a single HTML document containing content - images, stylesheets, and JS manipulating the document or the stylesheets ( reference items). When the user navigates from one page to another, it sends a URL request to the server pointing at a web resource in the form of a specific HTML document. The server responds by returning the document along with its adjoining files to the browser which replaces the previous content with all new content. This works fine, but it’s resource-intensive. Each new page requires a completed HTML document and the document has to be written by a developer or generated by a content management system before it’s downloaded and rendered in the browser.
How does a web application work?
In the app, each page is a VIEW representing the current state. When the visitor loads the site for the first time, all the components that make up the application are downloaded including an HTML framework, referenced items, one or more stylesheets, and some JS. The app then sends a URI or UNIVERSAL RESOURCE IDENTIFIER request for a web resource representing the next state of the application to be transferred and uses the resulting data to build the current view. When the visitor navigates from one view to another, the app sends a new URI request for the web resource representing the next stage of the application which is transferred and used to add, modify, replace, or delete the previous data. The key is this representational state is transferred as a data object, not the entire new set of files. And the app can update its data without rendering the whole new page. This allows us to create so-called single-page apps on the web and native apps for mobile devices and platforms that all use or consume the same REST resource.
What is API?
When you visit LinkedIn on your computer and your smartphone, you use two different applications to access the same data from the same REST resource. All this back and forth is controlled through an API. An API is a set of features and rules that exist inside 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, POST, PUT, and DELETE.