Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4802

Is it better to have one POST endpoint and be called multiple times or two POST endpoints one for creating one and the other for creating multiple?

$
0
0

Let's say we're creating a message. Some users can only send a message to one other user; meanwhile others have the possibility to send a message to one or more other users.

What would be better for this problem?

One endpoint to create one or multiple messages with one call /users/messages/create

One endpoint to create one message, but being called multiple times /users/:userId/messages

Two endpoints:One for being called only once to create one message /users/:userId/messagesOne for being called only once only to create multiple messages /users/multiple-users/messages

I know this is somewhat confusing as to why I am asking because /users/messages/create is just better, but I want to know what would be better for other developers. I also want to know the better practices for writing a RESTful API.


Viewing all articles
Browse latest Browse all 4802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>