Status Code
// Definition
A three-digit HTTP response code indicating outcome — 2xx success, 3xx redirect, 4xx client error, 5xx server error. The first signal an API test asserts on.
// Code Example
// 2xx — success
cy.request('/api/tools').its('status').should('eq', 200);
// 4xx — accept the failure response without throwing
cy.request({
url: '/api/tools/missing',
failOnStatusCode: false,
}).its('status').should('eq', 404);// Related terms
REST
Representational State Transfer — an architectural style for HTTP APIs where resources are addressed by URLs and manipulated via standard HTTP verbs (GET, POST, PUT, DELETE). The dominant API style for over a decade.
Endpoint
A specific URL exposed by an API that accepts requests and returns responses. Defined by its path, HTTP method, and contract.
Payload
The data carried in the body of a request or response, typically JSON or XML. The 'what' an HTTP message is communicating — distinct from headers and metadata.
Learn more · API Testing Masterclass
Chapter 1 · Lesson 3: HTTP Methods, Status Codes, and Headers