Types of APIs: REST, SOAP, GraphQL, gRPC, WebSocket and Webhooks

Types of APIs: REST, SOAP, GraphQL, gRPC, WebSocket and Webhooks

“Which types of APIs have you tested?” is one of the most common API testing interview questions, and a weak answer instantly shows a lack of real experience. In this lesson you will learn both ways to classify APIs (by who can use them and by how they are built), see a real product that uses each type, and learn what a tester must check differently for each one.

Quick answerAPIs are classified in two ways. By access: Open (public), Partner, Internal (private) and Composite APIs. By architecture or protocol: REST, SOAP, GraphQL, gRPC, WebSocket and Webhooks (plus older RPC styles such as JSON-RPC and XML-RPC). REST is the most common in web and mobile apps, SOAP is still common in banking and insurance, GraphQL in data-heavy apps, gRPC between microservices, WebSocket for real-time updates and webhooks for event notifications.
Advertisement

Classification 1: Types of APIs by Access

1. Open APIs (Public APIs)

Available to any developer, sometimes with a free API key. They usually have strict rate limits.

Real-life examples OpenWeatherMap (weather data in travel apps), Google Maps Platform (maps inside Ola or Zomato), GitHub REST API, and the SQA Tools practice API you use in this course.

What to test: rate limiting (429 Too Many Requests), API key validation, clear documentation matches behaviour, backward compatibility between versions, and behaviour under abuse such as huge page sizes.

2. Partner APIs

Shared only with business partners under a contract. Access is given after onboarding, often with stronger authentication (OAuth 2.0 client credentials, mutual TLS, IP allow-listing).

Real-life examples Razorpay or PayU payment gateway APIs used by online stores; airline inventory APIs used by MakeMyTrip; courier APIs (Delhivery, Blue Dart) used by e-commerce sellers to create shipments and track parcels.

What to test: contract (field names, formats) exactly as agreed, sandbox vs production behaviour, signature or HMAC validation, idempotency keys (so a retry doesn’t charge a customer twice), and webhook callbacks.

3. Internal APIs (Private APIs)

Used only inside a company, between its own apps and services. Most APIs a tester works on daily are internal.

Real-life example Inside Swiggy, the mobile app calls an internal “restaurant listing” API, which calls internal “menu”, “offers” and “delivery-time” APIs. None of these are open to the public.

What to test: business rules, integration between services, authorization between roles, and data consistency. Don’t assume “internal” means “safe”: internal APIs are a frequent source of data leaks.

4. Composite APIs

One API call that internally triggers several other API calls and returns a combined answer. Often provided by a Backend-for-Frontend (BFF) layer to reduce mobile network calls.

Real-life example When you open an order in the Amazon app, one composite call such as GET /order-summary/123 gathers order details, shipment tracking, payment status and return eligibility from four services.

What to test: partial failures (what if the tracking service is down: error, or a response with tracking missing?), timeouts, correct merging of data, and performance of the whole chain.

Advertisement

Classification 2: Types of APIs by Architecture and Protocol

TypeData formatTransportTypical useReal example
RESTJSON (sometimes XML)HTTP/1.1, HTTP/2Web and mobile appsFlipkart product and cart APIs
SOAPXML only (envelope)HTTP, sometimes JMS/SMTPBanking, insurance, government, telecomCore banking fund transfer, insurance policy issue
GraphQLJSONHTTP (single endpoint)Data-heavy UIs with varying needsGitHub API v4, Shopify Storefront API
gRPCProtocol Buffers (binary)HTTP/2Fast service-to-service callsMicroservices at Netflix, Uber
WebSocketAny (often JSON)Persistent TCP connectionReal-time, two-wayLive cricket scores, stock tickers, chat
WebhookJSONHTTP POST from server to youEvent notificationsRazorpay “payment.captured”, GitHub push event
JSON-RPC / XML-RPCJSON / XMLHTTPCalling remote functions by nameEthereum nodes (JSON-RPC), older CMS systems

REST APIs

REST (Representational State Transfer) is an architectural style, not a protocol. Everything is a resource with a URL (/users/1), and you act on it with HTTP methods (GET, POST, PUT, PATCH, DELETE). It is stateless, cacheable and uses standard status codes.

GEThttps://sqatools.in/wp-json/sqa-api/v1/products/101
curl -i \
  "https://sqatools.in/wp-json/sqa-api/v1/products/101"

What to test in REST: correct methods and status codes, JSON schema, filters and pagination, headers (ETag, caching), authentication, idempotency of PUT and DELETE.

Advertisement

SOAP APIs

SOAP (Simple Object Access Protocol) is a strict, XML-based protocol. Every message is an XML envelope with an optional header and a body. The contract is described in a WSDL file, which tools such as SoapUI read to generate requests automatically.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:bank="http://example.com/bank">
  <soapenv:Header>
    <bank:AuthToken>abc123</bank:AuthToken>
  </soapenv:Header>
  <soapenv:Body>
    <bank:GetBalance>
      <bank:AccountNumber>XXXX4521</bank:AccountNumber>
    </bank:GetBalance>
  </soapenv:Body>
</soapenv:Envelope>
Why banks still use SOAP Built-in standards for security (WS-Security), reliable messaging and transactions, plus a strict contract that both sides must follow. Many core banking, insurance and government systems built 10 to 20 years ago still expose SOAP services, so SoapUI skills remain in demand.

What to test in SOAP: WSDL validity, XML schema (XSD) compliance, SOAP Faults for errors (usually HTTP 500 with a <soap:Fault>), WS-Security headers, and XPath assertions on response values.

GraphQL APIs

GraphQL has a single endpoint (usually POST /graphql). The client writes a query that asks for exactly the fields it needs, so there is no over-fetching or under-fetching.

query {
  user(id: 1) {
    name
    orders(last: 2) { id total status }
  }
}

What to test in GraphQL: queries and mutations, field-level authorization, errors returned inside an errors array (often with HTTP 200!), deeply nested queries that could overload the server (query depth and complexity limits), and introspection being disabled in production.

Advertisement

gRPC APIs

gRPC, created by Google, sends compact binary messages (Protocol Buffers) over HTTP/2. The contract lives in a .proto file. It is much faster than JSON, supports streaming, and is popular for internal microservice traffic.

service PriceService {
  rpc GetPrice (PriceRequest) returns (PriceReply);
}
message PriceRequest { int32 product_id = 1; string pincode = 2; }
message PriceReply  { double price = 1; string currency = 2; }

What to test in gRPC: gRPC status codes (OK, NOT_FOUND, INVALID_ARGUMENT, DEADLINE_EXCEEDED), deadlines and timeouts, streaming behaviour, and backward compatibility of the .proto file. Tools: Postman (gRPC requests), grpcurl, BloomRPC-style clients and k6.

WebSocket APIs

A WebSocket opens one long-lived connection where both sides can send messages at any time. No repeated polling.

Real-life example: live cricket score Cricbuzz-style apps keep a WebSocket open. When a wicket falls, the server pushes {"event":"wicket","score":"145/4"} instantly to millions of phones. The same idea powers Zerodha Kite price ticks and WhatsApp Web messages.

What to test: connection handshake (HTTP 101 Switching Protocols), message order and format, reconnection after network drop, authentication on connect, heartbeat/ping, and load with many simultaneous connections.

Advertisement

Webhooks (Reverse APIs)

With a normal API you call the server. With a webhook, the server calls you when an event happens, by sending an HTTP POST to a URL you registered.

Real-life example: payment confirmation An online store registers https://shop.com/webhooks/razorpay. When a customer’s payment succeeds, Razorpay POSTs a payment.captured event with a signature header. The store verifies the signature and marks the order as paid, even if the customer closed the browser.

What to test: signature verification (reject tampered payloads), duplicate deliveries (the same event twice must not ship two parcels), retries when your endpoint is down, ordering of events, and quick 2xx acknowledgement. Tools such as webhook.site help you capture webhook calls while testing.

Which API Type Should You Learn First?

  1. REST: over 80% of the APIs you will test. Master it first (this course focuses on it).
  2. SOAP with SoapUI, if you target banking, insurance or service companies with enterprise clients.
  3. GraphQL: growing fast in product companies.
  4. WebSocket, webhooks and gRPC: learn the concepts and test approach; tools are similar.
Advertisement

Testing Checklist by API Type

TypeMain toolKey assertionsTypical bug
RESTPostman, PlaywrightStatus, JSON body, schema, headersWrong status code, missing validation
SOAPSoapUIXPath values, XSD, SOAP FaultNamespace mismatch, fault without details
GraphQLPostman, Playwrightdata and errors, field authErrors hidden in 200 responses
gRPCPostman, grpcurlgRPC status, message fieldsBreaking .proto change
WebSocketPostman, PlaywrightMessage content and orderNo reconnect after network drop
Webhookwebhook.site, mock serverSignature, payload, retriesDuplicate event processed twice
Advertisement

Interview Questions: Types of APIs

What are the different types of APIs?

By access: Open/public, Partner, Internal/private and Composite APIs. By architecture: REST, SOAP, GraphQL, gRPC, WebSocket, webhooks and RPC styles such as JSON-RPC and XML-RPC.

Which types of APIs have you tested?

Answer with specifics: for example, “Internal REST APIs for an e-commerce order service using Postman and Playwright, a partner payment gateway API including webhooks, and SOAP services of a banking client in SoapUI.” Mention one interesting bug you found.

What is a composite API?

A single API call that internally calls several other APIs and returns a combined response, often used by a Backend-for-Frontend layer to reduce the number of mobile network calls.

What is a webhook and how is it different from an API?

A webhook is an HTTP callback: the provider sends a POST to your URL when an event happens. With a normal API the client pulls data; with a webhook the server pushes it. Webhooks must be verified with signatures and handled idempotently.

What is WSDL?

Web Services Description Language is an XML document that describes a SOAP service: its operations, message formats, data types and endpoint address. SoapUI imports it to create test requests automatically.

When would you use WebSocket instead of REST?

When the server needs to push frequent real-time updates, such as live scores, stock prices, chat or ride tracking. Polling a REST endpoint every second would waste bandwidth and add delay.

What is gRPC and why is it fast?

gRPC is a remote procedure call framework that uses binary Protocol Buffers over HTTP/2, which gives small messages, multiplexed connections and streaming. It is mostly used for internal service-to-service communication.

Why can GraphQL return 200 OK for an error?

Because a GraphQL request can partly succeed, errors are reported in an errors array in the body while the HTTP status is often 200. Testers must assert on the errors array, not only on the status code.

What is the difference between a public and a partner API from a testing point of view?

Public APIs need strong rate limiting, abuse protection and backward compatibility for unknown consumers. Partner APIs need strict contract testing, stronger authentication, sandbox testing and webhook/signature validation agreed with specific partners.

Is REST a protocol?

No. REST is an architectural style that usually runs over HTTP. SOAP is a protocol with a formal specification.

Advertisement
View the full API testing syllabus