API and API Design

Backend Engineering

API and API Design

Designing REST API → Resource Names, Actions & Associations

Designing REST API → Resource Names, Actions & Associations

Designing a RESTful API involves defining clear and consistent resource names, actions, and associations to ensure clients' ease of use and understanding.

Resource Names, Actions, & Associations

Several best practices regarding resource names, actions, and associations must be followed to design an effective RESTful API.

Resource Naming Practices:

  • Use nouns to represent resources (e.g., /books/authors).

  • Prefer plural nouns for resource collections (e.g., /books instead of /book).

  • Use lowercase letters and separate words with hyphens for readability (e.g., /book-reviews).

Actions as HTTP Methods:

  • Use GET to retrieve resources.

  • Use POST to create new resources.

  • Use PUT to update existing resources.

  • Use DELETE to remove resources.

Associations:

  • Represent hierarchical relationships with nested resources (e.g., /authors/{authorId}/books).

  • For many-to-many relationships, use linking tables (e.g., /books/{bookId}/reviews).

Adhering to these practices ensures your API is intuitive, consistent, and easy to maintain.

Whenever you're ready

There are 4 ways we can help you become a great backend engineer:

The MB Platform

Join 1000+ backend engineers learning backend engineering. Build real-world backend projects, learn from expert-vetted courses and roadmaps, track your learnings and set schedules, and solve backend engineering tasks, exercises, and challenges.

The MB Academy

The “MB Academy” is a 6-month intensive Advanced Backend Engineering BootCamp to produce great backend engineers.

Join Backend Weekly

If you like post like this, you will absolutely enjoy our exclusive weekly newsletter, Sharing exclusive backend engineering resources to help you become a great Backend Engineer.

Get Backend Jobs

Find over 2,000+ Tailored International Remote Backend Jobs or Reach 50,000+ backend engineers on the #1 Backend Engineering Job Board