What is API?
· Application programming interfaces (APIs) provide the platform and medium for applications to talk to and understand each other.
· APIs specify the way information passed across platforms is structured so that applications can exchange data and information.
· Each URL is called a request while the data sent back to you is called a response.
REST API (Representation State)
· Open-source web Automation Testing Technique.
· REST is an API architecture style.
· It is approach for communication used in the development of webservices.
· REST became the logical choice of building APIs.
· REST specifies how data is presented to a client in a format that is convenient for the client.
· Data exchanges happen either in JSON or XML format.
Set of recommendations and constraints for RESTful web services.
1.Client-Server: System A makes an HTTP request to a URL hosted by System B, which returns a response.
2.Stateless: REST is stateless, the client request should contain all the information necessary to respond to a request.
3.Cacheable: A response should be defined as cacheable or not.
4.Layered: The requesting client need not know whether it’s communicating with the actual server, a proxy, or any other intermediary.
How do REST APIs Work?
It uses method used to send request to the server. The four main methods that are associated with REST APIs are:
1.Get (Read)
2.Post (Create)
3.Put (Update)
4.Delete
1.Get: Extract Information from the server using a Url.
· It should only extract and should not have any effect on the data.
2.Post (Create): A Post request is used to create a new entity.
· It is similar to a creating a new record in the server.
3.Put: Modifying an entity
· It is similar to an updating on an existence one.
4.Delete: Remove the current entity
· It removes the current entity given by the url.
コメント