API is an acronym for Application Programming Interface. It is clear from the name that while performing API testing we will be doing testing at backend which do not offer GUI rather works at back-end.
API is set of rules or standards for accessing a web based service. A software company releases its API so that others can design products that are powered by their services.
API’s are software to software interface not the user interface. With API’s web applications talk to each other without any user intervention or knowledge.
APIs and Web services are completely invisible to Web site surfers and software users. Their job is to run silently in the background, providing a way for applications to work with each other to get the user the information or functionality he needs.
Approach of API Testing:-
There are basically 3 layers in a web based software. Presentation layer, business layer and database layer.
API testing is focused on the functionality of the software's business logic and it is entirely different from GUI testing. It mainly concentrates on the business logic layer of the software architecture. This testing won't concentrate on the look and feel of an application.
API testing is mostly used for the system which has collection of API that needs to be tested. The system could be system software, application software or libraries.
For starting API Testing database and server should be configured as per the application requirements. API Function should be called to check whether that API is working.
Output of an API could be any data, status i.e. pass or fail, call some other API function, update some data or trigger some event or modify certain resource or information.
API testing is checking Application Programming Interface of a Software System. In order to check API we need some software to call API. One of the efficient tool for developing and testing API is Postman (an extension of google chrome). With Postman you have all the flexibility you need to test your API, and it is stable enough to find the errors in your API.
Postmant client:- Postman is a powerful HTTP client to help test web services easily and efficiently. Postman is used only to test RESTful web services. Postman is a user friendly add-on for Chrome browser which provides an easy interface for the REST API testing
REST (Representational State Transfer).
REST is now days commonly used web service by all the tech geeks all around the world. It is a simple stateless architecture that generally runs over HTTP. REST is often used in mobile applications, social networking Web sites, mashup tools and automated business processes. The REST style emphasizes that interactions between clients and services is enhanced by having a limited number of operations.
REST web services communicate over the HTTP specification, using HTTP vocabulary:-
Methods (GET, POST, etc.)
HTTP URI syntax (paths, parameters, etc.)
Media types (xml, json, html, plain text, etc)
HTTP Response codes
Flow chart for RESTful web services:-
Client is the actual user who will try to access the web service through a URL and the web server will response for the same request.
Client can access the web service either through the computer or mobiles, the phenomenon will remain the same.Here webserver is working at business logic layer and computer and mobile works at presentation layer and database is working at database layer.
2. Click on free, it will ask your google account credentials, fill them and click on sign in.
3. A pop will come click on add and it will get added to your chrome browser.
Overview of postman interface:-
Example:- Now let us practically implement the above information and run twitter API for better understanding and flow of tool.
First we need to create a twitter application to retrieve data from twitter. So login into your
Add application details:-
- I have created this “sumit API postman app”, now go to the modify app permissions and set them to read and write so that we can perform both GET and POST operations.
- Now go to the API keys tab and click on regenerate as we have modified the permissions so different API key would be required for authenticating purpose.
- Now we are ready so open postman extension.
- Now let’s access the twitter API, twitter uses OAuth 1.0, open the tab for the same from the tab bar on top. This will authenticate and allow us to access the twitter services.
- Now open https://dev.twitter.com/ for knowing the url for API testing. Just follow the below steps:-
- On this page you can see the option fir generating URL’s for all available operations i.e. for GET, POST ,DELETE etc.
Suggestions are always welcome, please add if I have missed something or you have something extra to share in this context.