Status Code Meaning
Sreenidhi Rajakrishnan
100 Continue Request received, continue sending body
Automation Architect
1xx – Informational
@sreenidhirajakrishnan
101 Switching Protocols Server is changing protocol
API Testing Cheatsheet 102 Processing Request is being processed
Term Definition 200 OK Request successful
API Interface that allows different software systems to communicate 201 Created Resource created successfully
202 Accepted Request accepted for processing
2xx – Success
Status Codes and Meaning
Endpoint A specific URL where an API resource is accessed
Resource An object or data entity exposed by an API 204 No Content Success with no response body
HTTP Method Operation performed on a resource (GET, POST, etc.) 206 Partial Content Partial response returned
GET Retrieves data from the server 300 Multiple Choices Multiple response options available
POST Sends data to create a new resource 301 Moved Permanently Resource permanently moved
3xx – Redirection
PUT Replaces an entire existing resource 302 Found Resource temporarily moved
PATCH Updates part of an existing resource 304 Not Modified Cached response is still valid
DELETE Removes a resource from the server 307 Temporary Redirect Temporary redirect, method unchanged
Request Data sent from client to server 308 Permanent Redirect Permanent redirect, method unchanged
Response Data returned from server to client 400 Bad Request Invalid request data
Header Metadata sent with request or response 401 Unauthorized Authentication required or failed
Body Payload containing actual request or response data 403 Forbidden Access denied
4xx – Client Errors
Query Parameter Key-value data passed in the URL 404 Not Found Resource not found
Path Parameter Variable embedded in the endpoint path 405 Method Not Allowed HTTP method not supported
Status Code Numeric code indicating request result
408 Request Timeout Client took too long
Content-Type Format of request or response data
409 Conflict Request conflicts with current state
Accept Format expected in response
410 Gone Resource permanently removed
JSON Lightweight data exchange format
415 Unsupported Media Type Invalid content type
API Terminologies
XML Markup-based data exchange format
422 Unprocessable Entity Valid request but semantic error
REST Stateless API architectural style
429 Too Many Requests Rate limit exceeded
SOAP Protocol-based API standard
500 Internal Server Error Generic server failure
5xx – Server Errors
Stateless Server does not store client session
501 Not Implemented Feature not supported
Idempotent Same request produces same result
502 Bad Gateway Invalid response from upstream
Payload Actual data sent in request or response
503 Service Unavailable Server temporarily down
Authentication Process of verifying user identity
504 Gateway Timeout Upstream service timeout
Authorization Process of validating access rights
API Key Unique identifier for API access Command Single-Line Code Example Purpose / What it Does
Bearer Token Token-based authentication mechanism given() given() Starts building the request
JWT Encoded token containing user claims when() when() Specifies the HTTP action
OAuth 2.0 Authorization framework for secure access then() then() Validates the response
Rate Limiting Restriction on number of API requests baseURI [Link] = Sets the base URL
"[Link]
Throttling Controlled slowing of API traffic basePath [Link] = "/users"; Sets the base path
Rest Assured Commands
CORS Browser security rule for cross-origin calls header() given().header("Authorization","Bearer token") Adds a request header
HTTPS Secure communication protocol headers() given().headers("k1","v1","k2","v2") Adds multiple headers
Encryption Protection of data using cryptography queryParam() given().queryParam("page",1) Adds query parameter
Schema Defined structure of API data pathParam() given().pathParam("id",10) Adds path parameter
Contract Agreement on request and response structure body() given().body(payload) Sets request payload
Swagger Tool for API documentation and testing contentType() given().contentType([Link]) Sets request content type
OpenAPI Standard specification for REST APIs Sets expected response
accept() given().accept([Link])
type
Mock Server Simulated API for testing
get() when().get("/users") Sends GET request
Stubbing Providing fake API responses
post() when().post("/users") Sends POST request
API Versioning Managing changes across API versions
put() when().put("/users/1") Sends PUT request
Pagination Splitting large data into pages
patch() when().patch("/users/1") Sends PATCH request
Filtering Limiting response data based on criteria
delete() when().delete("/users/1") Sends DELETE request
Sorting Ordering response data
statusCode() then().statusCode(200) Validates status code
Timeout Maximum wait time for response
body() (assert) then().body("id", equalTo(1)) Validates response body
Retry Reattempting failed API requests
extract() then().extract().response() Extracts response values
Circuit Breaker Prevents repeated calls to failing service
jsonPath() [Link]().get("name") Reads JSON response
Logging Recording API request and response data
log().all() given().log().all() Logs full request/response
Monitoring Tracking API performance and health
log().body() then().log().body() Logs request or response
SLA Guaranteed service availability body
auth().basic() given().auth().basic("user","pwd") Basic authentication
API Gateway Central entry point for API requests
auth().oauth2() given().auth().oauth2(token) OAuth2 authentication
Microservices Architecture with independent services
time() then().time(lessThan(2000L)) Gets response time
Sreenidhi Rajakrishnan Automation Architect @sreenidhirajakrishnan Follow for More on AI & Automation