REST

API Testing

// 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

CypressTest a REST endpoint with cy.request
TypeScript
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

Learn more · API Testing Masterclass

Chapter 1 · Lesson 2: REST Architecture and Principles