Today I learned that RESTful API endpoints should only use nouns, not verbs.
I was building some endpoints for a project and had things like /getUsers and /createUser.
They worked fine, but it’s not proper REST design and somebody pointed out this to me.
The HTTP method (GET, POST, PUT, DELETE) already acts as the verb. So it should just be /users with the appropriate method. GET /users fetches them, POST /users creates one.
No comments yet. Be the first!
Leave a comment
All comments are moderated and appear after approval. Your email is optional and won't be shared. If your comment needs a personal reply, I'll reach out by email.