Rest API for beginners,Client Server Architecture,HTTP Methods,get(),post(),delete(),put()
A RESTful API is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. A RESTful API — also referred to as a RESTful web service — is based on representational state transfer (REST) technology.
Reference URL ->https://www.service-architecture.com/articles/web-services/representational_state_transfer_rest.html
GET Method: Fetches all or any customer.
- Example1 : Get /Customer/ -Fetch All
- Example2: Get /Customer/1 – Fetch Customer1
POST Method: Create a Customer.
Example : POST /customer/?name=john&age=30
PUT Method: Updates the Customer.
Example: PUT /customer/?newname=james&age=20
DELETE Method: Deletes the Customer
Example: DELETE /customer/1
Facebook API Example for Reference:http://total-qa.com/rest-services/restapi-examples/
REST APIs are stateless, meaning that calls can be made independently of one another, and each call contains all of the data necessary to complete itself successfully. A REST API should not rely on data being stored on the server or sessions to determine what to do with a call, but rather solely rely on the data that is provided in that call itself. Identifying information is not being stored on the server when making calls. Instead, each call has the necessary data in itself, such as the API key, access token, user ID, etc
Because a stateless API can increase request overhead by handling large loads of incoming and outbound calls, a REST API should be designed to encourage the storage of cacheable data. This means that when data is cacheable, the response should indicate that the data can be stored up to a certain time (expires-at), or in cases where data needs to be real-time, that the response should not be cached by the client. Developers use Elastic Search to maintain Cache for the REST FULL Services.
Elasticsearch is an open-source, RESTful, distributed search and analytics engine built on Apache Lucene. Since the first version of Elasticsearch was released in 2010, it has quickly become the most popular search engine, and is commonly used for log analytics, full-text search, and operational intelligence use cases.