100% found this document useful (1 vote)
410 views10 pages

API Testing: A Comprehensive Guide

The document provides an overview of API testing, explaining the roles of clients and servers in communication, and defining what an API is. It outlines different types of APIs, including open, internal, partner, and composite APIs, as well as differentiating between APIs, web services, and microservices. Additionally, it covers key terminologies, HTTP methods, and status codes relevant to API testing.

Uploaded by

leelavathikantu
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
100% found this document useful (1 vote)
410 views10 pages

API Testing: A Comprehensive Guide

The document provides an overview of API testing, explaining the roles of clients and servers in communication, and defining what an API is. It outlines different types of APIs, including open, internal, partner, and composite APIs, as well as differentiating between APIs, web services, and microservices. Additionally, it covers key terminologies, HTTP methods, and status codes relevant to API testing.

Uploaded by

leelavathikantu
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?


Client is a device or software (like a computer, phone, or browser) that sends
requests to get services or data.
For example, when you use a browser to open a website, your browser acts as
the client.
Server is a powerful computer or software that receives those requests,
processes them, and sends back the requested data or service.
For instance, when you open a website, the server provides the webpage to
your browser.

[Link] [Link]
Client/Server Architecture

[Link] [Link]
What is an API?

API (Application Programming Interface) is like a messenger that helps two


programs or systems talk to each other and share information.
For example:
• Imagine you’re using a food delivery app. When you select a restaurant
and place an order, the app uses an API to communicate with the
restaurant’s system to check the menu, place your order, and confirm it.
• APIs define the rules for how this communication happens, like what
data can be sent, how to ask for it, and what the response will look like.
It’s like a waiter in a restaurant, taking your request to the kitchen and
bringing back your food. The API (waiter) ensures both sides (you and the
kitchen) understand each other!

API - Restaurant Analogy

[Link] [Link]
API - MakeMyTrip Analogy

** API is a way of communication between two layers.

[Link] [Link]
Types Of API
APIs come in different types based on how and where they are used.
Open APIs (Public APIs):
• These are open for everyone to use. Developers can access them
without restrictions (or with minimal requirements).
• Example: Google Maps API lets any app show maps and directions.
Internal APIs (Private APIs):
• These are used only within a company or organization. They help
internal systems or teams communicate securely.
• Example: A company's HR system API to access employee data for
payroll processing.
Partner APIs:
• These are shared with specific partners or businesses. They require
special permissions or agreements to use.
• Example: A travel app using an airline’s API to show flight details.
Composite APIs:
• These combine multiple APIs into one call, allowing you to get data from
different sources in a single request.
• Example: An e-commerce app using a composite API to retrieve product
info, pricing, and customer reviews all at once.

API Vs Webservice Vs Microservice

Here’s a simple comparison of API, Web Service, and Microservice:


[Link] (Application Programming Interface)
• What it is: A way for different software systems or applications to
communicate with each other.
• How it works: It defines rules for how one app can request data or
services from another. APIs don’t have to use the internet—they can
work locally, too.
[Link] [Link]
• Example: Your phone’s weather app uses an API to get weather data
from a weather server.
2. Web Service
• What it is: A type of API that works specifically over the internet (using
HTTP).
• How it works: It enables two systems to exchange data (often using XML
or JSON).
• Example: A payment gateway like PayPal’s web service allows e-
commerce websites to process payments online.
Key point: All web services are APIs, but not all APIs are web services.

3. Microservice
• What it is: A small, independent part of an application that does one
thing well. A large app is built by combining many microservices.
• How it works: Each microservice communicates with other
microservices via APIs. They are self-contained and can run
independently.
• Example: In an online shopping app, separate microservices might
handle user login, product catalogue, payments, and order tracking.

Rest API HTTP Methods

[Link] [Link]
http Vs https

[Link] [Link]
Terminologies

URI – Uniform Resource Identifier


URL – Uniform Resource Locator
URN – Uniform Resource Name

Feature & Resource


‘Feature’ is the term used in manual testing to test some functionality and
similarly ‘Resource’ is the term used in API Automation testing referring some
functionality.

Payload
payload means body in the HTTP request and response message.
• Request Payload
• Response Payload

[Link] [Link]
HTTP Status Codes

[Link] [Link]
[Link] [Link]

Common questions

Powered by AI

APIs are interfaces allowing different software systems to communicate, and they do not necessarily require internet connectivity. Web services, a subset of APIs, operate specifically over the internet using protocols like HTTP and often exchange data in formats like JSON or XML. Microservices, unlike both APIs and web services, are defined as small, independent components of a larger application, each serving a singular purpose and communicating with each other through APIs. These differences highlight varying scopes and operational environments for each mechanism .

A developer might choose an Internal API over an Open API for a company's payroll system to ensure enhanced security and privacy of sensitive employee information. Internal APIs are restricted to use within the company, preventing unauthorized external access and reducing the risk of data breaches. They allow secure and controlled interaction between the payroll system and other internal applications or databases, maintaining organizational confidentiality and integrity .

The analogy of an API as a waiter helps clarify API communication by likening the API to a waiter who conveys orders from diners (requests) to the kitchen (server) and brings back the food (response). This comparison emphasizes the API's role in ensuring requests and responses are in a mutually understood format, similar to how a waiter ensures communication between diners and kitchen staff, defining roles, data format, and transaction flow .

A company might prefer a Partner API over an Open API when the interaction involves sensitive business information or proprietary technologies that are intended for controlled access. Partner APIs ensure security and exclusivity by requiring specific permissions or agreements, thereby allowing shared access with trusted collaborators, such as providing a travel app special access to airline flight details, without exposing it to wider audiences .

Microservice architecture enhances large applications by dividing them into smaller, independent units, each performing a distinct function. This segregation allows for straightforward, autonomous development and deployment of individual services, such as a user login or payment processing in an online shopping app. Each microservice can operate independently and interact with others via APIs, promoting flexibility and scalability while ensuring that a failure in one service does not impede the overall system functionality .

Differentiating between URI, URL, and URN is crucial in web APIs because each serves distinct purposes in resource identification. A URI is a general identifier for a resource, encompassing both URL and URN. A URL specifies the means to access a resource, providing its address on the internet, while a URN identifies a resource by name within a given namespace, without outlining its location. These distinctions are vital for accurate resource referencing and access in API design and implementation .

Using HTTP in API communication implies that data is transmitted in plain text, making it vulnerable to interception and attacks. In contrast, HTTPS encrypts data between the client and server, enhancing security by preventing unauthorized access and ensuring data integrity and confidentiality. Employing HTTPS in API communication thus protects sensitive information, builds user trust, and complies with security standards .

An API in a food delivery app serves as a communication facilitator between the client's device (such as the app on a mobile phone) and the server (such as the restaurant's system). It allows the app to send requests to the restaurant system to check the menu, place an order, and receive confirmation of the order. APIs define how these interactions are structured, akin to a waiter who takes orders from customers and conveys them to the kitchen, ensuring both sides comprehend each other .

Composite APIs streamline data retrieval in an e-commerce application by aggregating multiple API calls into a single request. This allows an app to concurrently obtain comprehensive data, such as product information, pricing, and customer reviews, from diverse sources without the need for multiple consecutive requests. This integration reduces latency, enhances performance, and simplifies the overall interaction process needed to display cohesive information to users .

Open APIs, also known as Public APIs, are accessible to anyone with minimal requirements, enabling external developers to integrate functionalities like Google Maps. Internal APIs are restricted for use within an organization, facilitating secure communication between its internal systems, such as a company's HR system. Partner APIs are designed for specific use by selected partners or businesses and typically require specific permissions or agreements, exemplified by a travel app accessing flight details from an airline's API .

You might also like