Complete Guide to HTTP API Testing: From Basics to Advanced Debugging Techniques
What is HTTP API Testing
HTTP API testing is the core method for verifying whether RESTful services work properly. Whether you're a backend developer debugging interfaces or a frontend developer integrating data, you need a reliable API testing tool.
While traditional tools like Postman are powerful, they require client installation and account registration. For quick debugging scenarios, online API testing tools are much more convenient — try our free API tester with no installation required.
HTTP Request Methods Explained
GET Request
GET is used to retrieve resources and is the most common HTTP method:
# Basic GET request
GET https://api.example.com/users
# With query parameters
GET https://api.example.com/users?page=1&limit=10
Use cases:
- Querying user lists
- Retrieving single resource details
- Searching and filtering data
POST Request
POST is used to create new resources:
# JSON request body
POST https://api.example.com/users
Content-Type: application/json
{
"name": "张三",
"email": "zhangsan@example.com"
}
Common Content-Type:
| Type | Description | Use Case |
|---|---|---|
application/json | JSON format | Common for modern APIs |
application/x-www-form-urlencoded | Form format | Traditional form submission |
multipart/form-data | Multi-file upload | File upload endpoints |
PUT Request
PUT is used for complete resource updates:
# Update user info (complete data required)
PUT https://api.example.com/users/123
Content-Type: application/json
{
"name": "李四",
"email": "lisi@example.com",
"role": "admin"
}
PATCH Request
PATCH is used for partial resource updates:
# Update only email (only modified fields required)
PATCH https://api.example.com/users/123
Content-Type: application/json
{
"email": "newemail@example.com"
}
DELETE Request
DELETE is used to delete resources:
DELETE https://api.example.com/users/123
Request Headers Configuration
Common Headers
| Header | Purpose | Example |
|---|---|---|
Content-Type | Specify request body format | application/json |
Authorization | Authentication credential | Bearer token123 |
Accept | Expected response format | application/json |
User-Agent | Client identifier | Mozilla/5.0... |
Cache-Control | Caching strategy | no-cache |
Authentication Methods
Bearer Token:
Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
Basic Auth:
Authorization: Basic base64(username:password)
API Key:
X-API-Key: your-api-key-here
Using an Online API Testing Tool
ToolVault's API Testing Tool offers the following features:
Core Features
- Multi-method support: GET, POST, PUT, PATCH, DELETE
- Custom Headers: Visual header editor
- Request body editor: JSON, Form, and Raw — Raw+JSON is syntax-checked before send so half-written bodies never leave the browser
- Response preview: JSON shows top-level keys; if Content-Type claims JSON but the body is HTML, a mismatch banner appears (classic gateway error page)
- Timeout vs cancel: Default 30s (adjustable in Settings); timeouts and manual cancels get distinct messages instead of one ambiguous line
Usage Steps
- Enter the request URL
- Select the HTTP method
- Configure headers (if needed)
- Edit the body (if needed) — for Raw+JSON, fix syntax first
- Click Send to submit the request
- Inspect status, timing breakdown, headers, and body; watch the preview chips for mismatch / HTML title
Practical Example: Testing User Registration Endpoint
POST https://api.example.com/register
Content-Type: application/json
{
"username": "testuser",
"password": "securepass123",
"email": "test@example.com"
}
Expected response:
{
"success": true,
"data": {
"id": 456,
"username": "testuser",
"createdAt": "2026-07-24T10:00:00Z"
}
}
Debugging Techniques
Status Code Quick Reference
| Status Code | Meaning | Common Cause |
|---|---|---|
| 200 | OK | Request processed normally |
| 201 | Created | Resource created successfully |
| 400 | Bad Request | Parameter validation failed |
| 401 | Unauthorized | Token missing or expired |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource does not exist |
| 429 | Too Many Requests | Rate limit triggered |
| 500 | Internal Server Error | Backend exception |
Troubleshooting Common Issues
CORS Errors:
- Cause: Browser cross-origin restrictions
- Solution: Configure CORS headers on the backend, or enable this tool's server proxy and inspect the real response headers
Timeout vs manual cancel:
- Timeout: the target did not answer within the configured seconds — raise the limit in Settings, then check slow queries / firewalls
- Cancel: you stopped the request; that is not a server outage
Body is HTML while Content-Type says JSON:
- Cause: frontend-route fallback, gateway error page, or an unauthenticated redirect to a login HTML page
- Solution: read the mismatch banner and page title in the tool, then check
Location/Content-Typein response headers
401 Unauthorized:
- Cause: Token expired or malformed
- Solution: Check Authorization header format, refresh the token; if a JWT appears in the response, open it in the on-site decoder and inspect
exp
Secrets discipline: the part every API guide skips
Testing tools hold credentials, and testing workflows leak them in specific, avoidable ways:
- Never inline tokens in saved requests — use environment variables (most clients support them), so exported collections carry
{{token}}placeholders instead of live credentials - Rotation-friendly setup: the token lives in exactly one variable, referenced everywhere — rotating then means changing one cell, not hunting twenty requests
- Headers vs logs: the
Authorizationheader is visible in any request-log pane; treat shared screenshots and exported HAR files as credential leaks by default, and scrub before sharing (HAR exports famously contain headers verbatim) - Scope test keys separately: sandbox keys that can't touch production data cost minutes to obtain and prevent the worst testing accidents
The habit worth building: before sharing anything a testing tool produced — collection, HAR, screenshot — ask "what credentials are in this picture?"
Practical habits
- Environment isolation: Use different API endpoints for development, testing, and production (environments in this tool help switch without editing URLs)
- Parameterization: Save frequently used requests as templates or collections
- Documentation sync: Update API documentation promptly after testing passes
- Automation: Write automated test scripts — or assertions inside this tool — for core endpoints
This article is provided by ToolVault. Visit the homepage for more developer tools.
Implementer's note
The API tester's server proxy looks simple but carries a real security surface: we added SSRF protection (rejecting intranet ranges and localhost), rate limiting and Origin checks — because an arbitrary server-side forwarder is inherently an SSRF springboard. Behind this article's advice sits an actual hardening checklist.
The response query also dodges a precision trap most tools ignore: JavaScript parses numbers as IEEE 754 doubles, so integers beyond 2^53-1 (backend snowflake IDs, for example) get silently rounded — 2099774875233849345 renders as ...300, which is worse than useless when you are debugging. This tool's response query and formatter parse losslessly and display such integers verbatim; if you copy the response into your own frontend code with JSON.parse, have the backend serialize IDs as strings instead.
Timeout copy used to hard-code "30s" even when Settings said otherwise — it now interpolates the real limit, and Abort reasons split into timeout vs user cancel so "I clicked Cancel" is not mistaken for an outage. Pre-send JSON syntax checks exist because a half-written body that leaves the browser turns a red squiggle in the editor into a server 400 plus a log dig.
Related Tools
Related Articles
Incomplete HTTPS Certificate Chain: Browser Distrusts a “Valid” Leaf
Leaf dates and SAN look fine, but clients still reject the cert? Usually a missing intermediate or misordered fullchain. Verify Issuer→Subject with openssl s_client and a local decoder.
HTTP GET vs POST: When to Use Each? Semantics, Safety, and Best Practices
GET vs POST semantics, idempotency, caching, URL length limits, security tradeoffs, REST conventions, and common mistakes. Includes curl examples and a decision table for picking the right method.
Unexpected token '<' is not valid JSON — 5 Reasons Your API Returned HTML Instead
fetch throws SyntaxError: Unexpected token '<' when the response body is HTML, not JSON. Covers the 5 root causes: SPA history fallback returning index.html, auth 302 redirects, gateway 502 error pages, wrong baseURL, and missing res.ok checks — with curl diagnostics.