What is REST?
REpresentational – representation of resource
State – representational state, changes all the time
Transfer
What is API?
Application Programming Interface – collection of useful methods/functions
Used for implementing in applications (e. g. Post on Twitter using API POST)
How it works in Http(hyper text transfer protocol)
- 💻 Client/application — REQUEST (e. g. Click on a link, type a URL) –> 🖥web server
- 💻 Client/application <– RESPONSE (representation of resource) — 🖥web server
- Representation e.g. : JSON, image, html, xml
- Resource e.g. : REST, xml-RPC, SOAP, JSON, serialized PHP
Request
REST API URL + API method + parameters
Request example In URL (uniform resource locator) form
protocol(e. g. Https)/host(e.g. abc.com)/path to the resource (/img/lily.jpg. Or lily.html etc.)
→ https://abc.com/img/lily.jpg
Request type
- GET: click on something
- POST: submit something/submit data (e.g. send info via click for subscription), add a child resource under resources collection. Use for CREATE operations.
- PUT : submit something/submit data. Modify a singular resource that is already a part of resources collection. Calling the same PUT request multiple times will always produce the same result. Use for UPDATE operations.
- DELETE: delete the resource
- Helpful info
Related Terms
OAuth
- an open standard for access delegation, commonly used as a way for Internet users to grant websites or applications access to their information on other websites but without giving them the passwords.
- e. g: send token inside of http header, as a parameter in the URI, combining with client id/secret etc. (https://www.youtube.com/watch?v=Q-BpqyOT3a8; 12:40)
- e.g. register a new OAuth to get access to github API
Pagination
- also known as paging, is the process of dividing a document into discrete pages, either electronic pages or printed pages. (e.g. 100 items per page)
cURL (Client URL)
- tools to transfer data using various protocols including httpEndpointone end of a communication channel, an endpoint can include a URL of a server or service with a domain, port, e path, and/or querystring
- e.g. https://abc.com/img/lily.jpg
Tools
- Apigee API Management
- Postman API Platform
- https://www.postman.com/tools to make request
- JSON Parser
- https://jsonparser.org/
- https://jsonformatter.org/json-parser
- might need to delete the most outer brackets to work
Helpful Info
- REST API & RESTful Web Services Explained | Web Services Tutorial (Clever Techie)
- What Is A RESTful API? Explanation of REST & HTTP (Traversy Media)