Better Programming

Advice for programmers.

Follow publication

Member-only story

10 Best Practices for Naming REST API Endpoints

Deddy Tandean
Better Programming
Published in
9 min readMay 31, 2021

Code on laptop
Photo by Christopher Gower on Unsplash.

Web developers are no strangers to APIs — especially HTTP methods like GET and POST. When it comes to designing APIs, backend engineers or API engineers are familiar with them as well. That means REST is a term that is familiar. It is said that REST is an architecture and not a standard. It was developed alongside HTTP and is most commonly used over HTTP. HTTP is a standard, whereas REST is an architecture. REST is an architectural style that provides constraints that guide API design.

REST APIs are a powerful tool that is widely used by systems to communicate and exchange information according to the Representational State Transfer (REST) architectural pattern. Be it by websites, mobile applications, or enterprise integrations, they are widely used. REST has much more flexibility compared to the previous generation of web services, namely SOAP.

However, in this article, we are going to talk about REST or RESTful only.

While REST APIs are extremely useful, creating them can be a time-consuming process. If you are building your own REST or RESTful API, you should know that there are best practices to follow. This includes the naming of your REST API endpoints.

There are basically ten guidelines that you can follow to make your API endpoints better:

  1. Use nouns.
  2. Use intuitive, clear names.
  3. Use lowercase letters.
  4. Avoid special characters.
  5. Use forward slash (/).
  6. Separate words with hyphens.
  7. Don’t use file extension.
  8. Use camelCase for parameters.
  9. Use API versioning.
  10. Consistency.

They do seem very simple to follow, but they are what can make your endpoints look better. So, let’s get started!

1. Use Nouns

When naming your URIs, it is advised to use nouns instead of verbs or adjectives. HTTP methods are technically verbs, hence GET, POST, DELETE, etc. Also, the names represent the contents of a resource or the resources…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Deddy Tandean
Deddy Tandean

Written by Deddy Tandean

💻engineer | ex-💰consultant. Writes any (IT and Finance) that helps or guides. Check out => https://linktr.ee/deddytandean

Responses (1)

Write a response