85% Discount for all November
Rest Assured
API Automation Testing
What is REST API?
REpresentational State Transfer- Application Programming Interface
API, an application programming interface is a set of rules that allow programs to talk to each other. The developer builds the API on the server and allows the client to talk to it.
REST determines how the API looks like. It stands for “Representational State Transfer”. It is a set of rules that developers follow when they create their API. One of these rules states that you should be able to get a piece of data (called a resource) when you link to a specific URL.
Each URL is called a request while the data sent back to you is called a response.
The Anatomy Of A Request:
The endpoint
The method
The headers
The data(or Body)
Let’s say you’re trying to find songs about your favorite singer on Youtube. You open up Youtube, type your singer into a search field, hit enter, and you see a list of videos about it. A REST API works similarly. You search for something and you get a list of results back from the service you’re requesting from.
Rest API vs API
Rest API and an API may sound similar, but they are a different ball of wax. API is more general term than the REST API.
APIs are the glue that connects one application to another with services and data getting access. The difference lies is that REST APIs are a web-service API or architectural style which utilizes HTTP protocol and JSON for data format. REST APIs bring about simplicity in development with limited resources and require less protection.
What are the possible technologies for REST?
HTTP
JSON/XML
OAuth
Webhooks
HTTP
We use HTTP methods when exchanging data with REST.
GET: The GET method is used to fetch the resource specified in the URI. This request does not have a body. It will only be a header.
HEAD: The only difference between the HEAD method and the GET method is that it does not send a body in response.
POST: We use the POST method to create a new resource on the server we send requests, to run controller resources, and to send form inputs.
As an example, we went through these, but there are other methods such as PUT, DELETE.
JSON/XML
Both JSON and XML can be used to receive data from a web servers, applications.
OAuth
The OAuth protocol is an open protocol that allows Web, Mobile, and Desktop applications to securely authorize applications in a simple and standard way. Thanks to OAuth, the safe provision of data with limited access, namely protected data, has been simplified.
Two versions have been released so far: OAuth 1.0 and OAuth 2.0. The OAuth 2.0 the protocol is the version that emerged in 2006 after a series of regulations on OAuth 1.0 for developers.
Webhook
Webhooks are user-defined HTTP callbacks. They are triggered by some event in a web application and can facilitate integrating different applications or third- party APIs.
Saturday, Mar 20, 2021