Blog
API testing guides and tutorials
Step-by-step guides for testing REST, GraphQL, gRPC, WebSocket, Socket.IO, SSE, MQTT and MCP APIs, writing tests, mocking and load testing. Each one uses examples you can run in Swastik Codes. Subscribe via RSS.
- API testing · Scripts
Chain API requests using values from the previous response
How to chain API requests: extract tokens and ids from a response with swc.* scripts, store them in variables, use them in the next request and run the sequence with the collection runner.
- cURL · Code generation
Convert cURL to Python, JavaScript and other code
Turn a cURL command into a request and then into Python, JavaScript or other code. Covers -X, -H, -d, --data-raw, -u, -F, -k, -L and --compressed, and copying cURL from browser devtools.
- Testing · Localhost
How to test a localhost API (and why web clients can't)
Why web-based API clients cannot call localhost on their own, how to test a local API with a local bridge, a desktop client, a tunnel or a staging deploy, and the Docker networking mistakes that look like client bugs.
- REST · API testing
How to test a REST API online, step by step
A beginner-to-intermediate walkthrough of testing a REST API in an online API tester: building requests, reading responses, saving to a collection, writing a test and running it.
- JWT · Authentication
How to test JWT authentication in an API
A practical guide to testing JWT-protected APIs: capture tokens in scripts, assert on claims, test 401 and 403 cases, mint test tokens with the JWT auth type and handle refresh.
- HTTP · REST
HTTP status codes explained, with API testing tips
A reference to the HTTP status codes APIs actually return, what RFC 9110 says each one means, what to verify when you see it, and how to assert status codes in swc.* tests.
- OpenAPI · Swagger
Import an OpenAPI spec and generate API tests
From OpenAPI file to a running test suite: what the import generates, environments for base URLs, contract tests from response schemas, linting, collection sync and runs.
- JSON Schema · API testing
JSON Schema validation in API tests
How to write a JSON Schema for an API response, validate it with swc.response.to.have.jsonSchema, pick the right draft, fix the usual mistakes and apply it across a collection.
- REST · GraphQL
REST vs GraphQL vs gRPC: differences and when to use each
An accurate comparison of REST, GraphQL and gRPC: transport, payload formats, contracts, streaming, caching, browser support and tooling, plus how to test each style.
- gRPC · Testing
A gRPC client in the browser: test gRPC APIs online
How to call and test a gRPC API from the browser with Swastik Codes: loading the schema by reflection or .proto upload, all four call types, metadata, deadlines and swc.test scripts.
- Performance · Load testing
API load testing in the browser: virtual users, profiles and percentiles
Run a load test against your API from the browser with virtual users and fixed, ramp-up, spike or peak profiles, and learn how to read throughput, p50/p95/p99 and error rate.
- API testing · Collection runner
Data-driven API testing with CSV and JSON files
Drive a collection run from a CSV or JSON data file, read each row in requests and scripts, control iterations and failure handling, export JUnit or HTML reports and reuse the data in monitors.
- GraphQL · API testing
GraphQL client online: test a GraphQL API in the browser
Load a schema by introspection, build queries with the explorer and autocomplete, use variables and fragments, run subscriptions and assert on GraphQL responses.
- Postman · Import
How to import a Postman collection into Swastik Codes (and export it back)
Step by step: export a collection, environment and globals from Postman as JSON, import them into Swastik Codes, read the import notes, and export back out when you need to.
- Mock server · REST
A free mock API server built from your saved examples
Turn the examples in a collection into a hosted mock REST API with a public URL, request matching, per-call x-mock-* headers, response templates and a call log.
- Socket.IO · WebSocket
How to test a Socket.IO server online (v2, v3 and v4)
A hands-on guide to testing Socket.IO servers with Swastik Codes: client versions, namespaces, the auth payload, emitting events, acknowledgements, listeners and common connection errors.
- WebSocket · Testing
How to test a WebSocket API online, step by step
A practical guide to testing a WebSocket API from the browser: connecting, sending frames, saving messages, headers and auth, and fixing common handshake errors.
- MCP · AI
How to test an MCP server online (tools, resources, prompts)
A practical guide to testing a remote Model Context Protocol server in the browser: transports, protocol versions, tool calls, notifications, elicitation, sampling, roots and OAuth discovery.
- SSE · Streaming
How to test Server-Sent Events (SSE) endpoints online
A practical guide to testing text/event-stream endpoints with Swastik Codes: connecting, filtering event types, resuming with Last-Event-ID, reconnection, and POST-based streams such as LLM APIs.
- Postman · Migration
Moving from Postman to a web-based API client: what carries over and what to check
What moves across from Postman (collections, environments, globals, scripts, auth, examples), what to check afterwards, and how to set up your team in Swastik Codes.
- MQTT · IoT
MQTT client online: test an MQTT broker in your browser
How to test an MQTT broker online with Swastik Codes: MQTT 3.1.1 and 5, mqtt:// mqtts:// ws:// wss://, QoS levels, retained messages, last will and MQTT 5 properties.
- OAuth 2.0 · Authentication
OAuth 2.0 in an API client: get and use access tokens
How to configure each OAuth 2.0 grant in Swastik Codes, register the callback URL, share one token across a collection, refresh it automatically and debug common token errors.
- API testing · Scripts
Write API tests with swc.* scripts (Postman pm.* compatible)
A hands-on guide to Postman-style test scripts: assertions, JSON Schema validation, variable scopes, swc.sendRequest, setNextRequest, script inheritance and the bundled libraries.