Just curious, but I am making an API and have been thus far using URLs like this:
/user/create
/user/[id]
and now I am adding
/user/create/batch
This made me wonder if there is any good reason I should call the user management endpoint ‘users’ rather than just ‘user’. Then again, maybe it doesn’t matter at all. I would at least guess I should be consistent about this either way.
Thoughts?
I nearly always use plurals in my url design. I always think of navigating in my url paths, similar to directories, where I am descending deeper and deeper.
There is a top resource (like
/users) which expresses a collection and there are sub-resources (like/users/{userId}/items) which itself is a collection.All apis and their representing domain I have seen so far would have fit to above recommendation.
Regarding your mentioned
/users/create/batchlooks like you want to encode an ‘action’ inside url. In a restful design over HTTP it would fit better if you use HTTP methodsPOST /users(single user payload) or for batch creation mode transmitting multiple users.What does the ‘create’ and ‘batch’ mean in your case?