#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
API Testing

Basic Knowledge of API & API Testing

What is an API?

An Application Programming Interface (API) is a set of rules that lets different software systems communicate with each other — typically by sending requests and receiving structured responses (often in JSON or XML) over HTTP.

What is API Testing?

API testing verifies that an API's endpoints behave correctly — returning the right data, the right status codes, and handling errors appropriately — without going through a graphical user interface.

Why API Testing Matters

  • It tests business logic directly, closer to where the real functionality lives.
  • It is typically faster and more stable than UI testing.
  • It can catch defects earlier, since APIs are often built before the UI.

How an API Call Works, Step by Step

Think of an API like a waiter in a restaurant. You do not walk into the kitchen; you give your order to the waiter, who brings back the dish. In software terms:

  1. The client (a mobile app, a website or a test tool) builds a request with a URL, a method such as GET or POST, headers and sometimes a body.
  2. The request travels over HTTP or HTTPS to the server.
  3. The server checks who is calling, validates the input and runs the business logic, often reading or writing a database.
  4. The server sends back a response with a status code and usually a JSON body.
  5. The client reads the response and shows the result to the user.

An API tester sits in the client's position, sends requests directly and checks every part of the response.

Your First API Test with curl

You can try a request from any terminal before learning a dedicated tool:

curl -i https://api.example.com/users/1

The -i flag shows response headers. A response might look like this:

HTTP/1.1 200 OK
Content-Type: application/json

{"id": 1, "name": "Neha", "email": "neha@example.com"}

A basic test asks three questions: is the status 200, is the content JSON, and do the fields hold the expected values? Next, try /users/99999, an ID that should not exist, and confirm the API returns 404 rather than an empty 200 or a server error. Replace the example address with the API you are allowed to test.

Types of API Testing

TypeWhat It Checks
FunctionalEach endpoint returns correct data for valid and invalid input
Contract or schemaResponse structure matches the agreed specification, such as an OpenAPI document
IntegrationSeveral APIs work together correctly, for example order and payment services
SecurityAuthentication and authorization are enforced and errors do not leak sensitive details
PerformanceResponse times and behaviour under expected load

REST, SOAP and GraphQL in brief

REST APIs use standard HTTP methods on resource URLs and usually return JSON; they are the most common today. SOAP APIs exchange XML messages defined by a WSDL contract and are still found in banking and enterprise systems. GraphQL APIs expose a single endpoint where the client asks for exactly the fields it wants. The testing mindset is the same for all three, though the tools and request formats differ.

Common Tools and Beginner Mistakes

Popular tools include Postman for manual and collection-based testing, Rest Assured for Java automation, and libraries such as requests with pytest in Python. Whatever you choose, avoid these early mistakes:

  • Testing only the happy path and skipping invalid or missing input.
  • Ignoring authentication, so nobody checks what happens without a valid token.
  • Relying on data that another tester might change or delete.
  • Not reading the API documentation before writing tests.

Ready to master real-world software testing?

Learn manual and automation testing hands-on with mentor-led sessions.

Explore Course