REST
// Definition
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.
// Code Example
it('GET /api/tools returns a list', () => {
cy.request('GET', '/api/tools').then((res) => {
expect(res.status).to.eq(200);
expect(res.body).to.be.an('array');
expect(res.body[0]).to.have.keys('id', 'name', 'category');
});
});// Related terms
GraphQL
A query language and runtime for APIs where clients specify exactly which fields they want in a single request. Replaces multiple REST endpoints with one flexible endpoint and a typed schema.
Endpoint
A specific URL exposed by an API that accepts requests and returns responses. Defined by its path, HTTP method, and contract.
Status Code
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.
Learn more · API Testing Masterclass
Chapter 1 · Lesson 2: REST Architecture and Principles