0% found this document useful (0 votes)
4 views24 pages

API Testing

The document provides an overview of API testing, explaining the roles of clients and servers, and detailing the client-server architecture. It discusses various types of APIs, their functionalities, and how to test them using Postman, including terminology and HTTP methods. Additionally, it covers JSON as a data format for communication and outlines different authentication methods for API access.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views24 pages

API Testing

The document provides an overview of API testing, explaining the roles of clients and servers, and detailing the client-server architecture. It discusses various types of APIs, their functionalities, and how to test them using Postman, including terminology and HTTP methods. Additionally, it covers JSON as a data format for communication and outlines different authentication methods for API access.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

API Testing

Introduction
What is Client & Server?
• A client is a computer hardware device or software that accesses a
service made available by a server.
• A server is a physical computer dedicated to run services to serve the
needs of other computers.
Client Server Architecture
What is an API?
API - Restaurant Analogy
MakeMyTrip Example
Other Examples
• Google Maps API used in Ola, Uber, WhatsApp, Swiggy
• Gmail Account used to log in Facebook, Linkedin,
Types of API

API Vs Webservice
REST API HTTP Methods
http Vs https
Terminologies
Feature & Resource
API Testing using Postman
• Both REST and SOAP APIs ca be tested using Postman
• Postman - Web and Desktop version
• Pre-requisite - Gmail account
Postman Terminologies:
Workspace:
• Area where we maintain all the files (test cases, requests etc.) and save
them.
• Whatever we do on postman, gets saved on a workspace
• Workspace is created by Postman using our gmail account.

Operations:
• Create
• Delete
• Rename
Postman Terminologies:
Collection:
• Collection is like a folder under a Workspace
• 1 Workspace can have n no. of Collections
• Under a Collection we can save our sub-folders, Test cases, http requests
• Without Collection, we can’t create our test cases or https requests

Operations:
• Create
• Rename
• Delete
• Run the Collection
https requests
• Get - retrieve the resource from the database
• Post - create a ressource on the database
• Put - update complete details of the existing resource on the database
• Patch - update partial details of the resource on the database
• Delete - delete the existing resource from the database

e.g.
emp_id , emp_name , emp_salary , emp_designation
JSON - Java Script Object Notation
• Communication between Client and Server happens in JSON or XML
• JSON - data format
What is JSON
JSON Data Types
• Number
• String
• Boolean
• Null
• Object
• Array

In JSON data is represented as key value pair


Key: Value
JSON Syntax
JSON vs XML
JSON vs XML Example
Authorization
• No Auth - No Authentication required

• API Key - a key is required to access the API

• Bearer Token - a token is required to access the API

• Basic Auth - username & password is required to access the API


• username & password will not be encrypted

• Digest Auth - username & password is required to access the API


• username & password will be encrypted

• OAuth 1.0 (old version) & OAuth 2.0 (new version)- 3rd party authentication
• very lengthy process to add these
• more secure
Summary
• 2xx = Everything’s fine, your request worked (e.g., 200, 201).
• 3xx = You need to be redirected somewhere else (e.g., 301, 302).
• 4xx = Something’s wrong with your request (e.g., 400, 404).
• 5xx = Something’s wrong on the server’s side (e.g., 500, 503).

You might also like