Monday, 10 February 2020

API

Before starting this topic, you need to answer the question.

What is API? 

API is Application Programming Interface.

In our application we can test the Front End/UI using the tools like selenium/QTP. But how we test the back end layer of the application.

API testing is the Back End Testing of the application.

API’s are used to interact with independent systems and the medium used for interaction is JSON/XML files. JSON/XML file is used to communicate with different systems. It can communicate with different technologies like from one system developed in Java to another system developed in dot net. There is an Authentication Key/Token Key for the security of the data.

The JSON request to a system is called ‘Request JSON Payload’ and the response from the system is called ‘Response JSON Payload’.

What is the difference between API and Web Services?

Consider the example of Make My Trip. They have a UI for capture the data like Destination from and to, From Date, Return Date, Passengers. That application converts this data in the form of JSON request payload and send it to the companies like Indigo, Spice jet Air Asia(using API). This flight companies return the price, time details in the response JOSN payload. Like that they communicate each other with the JSON files without exposing the sensitive internal data. This communication is with the http protocol over the network and they are called Web services.

Important features for web services:

1.Authentication-Session/Token ID
2.Username/Password
3.Request-Json/XML
4.HTTP Method-CRUD operation Normally GET calls
5.Security

API can be happened locally in the system without Network. If it is happening with in the network, it is called Web services. Two types of Web services SOAP and REST.SOAP API is not widely used now days; it is almost gone from the market.

SOAP 

  • SOAP is a protocol.                      
  • SOAP stands for Simple Object Access Protocol.     
  • SOAP can't use REST because it is a protocol.   
  • SOAP uses services interfaces to expose the business logic.
  • JAX-WS is the java API for SOAP web services.   
  • SOAP defines standards to be strictly followed.     
  • SOAP requires more bandwidth and resource than REST.     
  • SOAP defines its own security.     
  • SOAP permits XML data format only.
  • SOAP is less preferred than REST.             

REST

  • REST is an architectural style.
  • REST stands for Representational State Transfer.
  • REST can use SOAP web services because it is a  concept and can use any protocol like HTTP, SOAP.
  • REST uses URI to expose business logic.
  • JAX-RS is the java API for RESTful web services.
  • REST does not define too much standards like SOAP.
  • REST requires less bandwidth and resource than SOAP.
  • RESTful web services inherit security measures from the underlying transport.
  • REST permits different data format such as Plain text, HTML, XML, JSON etc.
  • REST more preferred than SOAP.

No comments:

Post a Comment