I have the following functionalities in my API:
- Getting a user by their name
- Getting a user by their ID
- Getting a user, or if it doesn't exist create one
- Getting multiple users by their ID
Currently I'm handling the two first functionalities with a GET
request, and the third with a POST
request. I could use a GET
request for getting multiple users, but sending potentially hundreds of IDs through a query parameter seems like the wrong approach, as I would get a very long URL. I could also use a POST
request to send the long list of IDs through its body, but I doubt a POST
request is meant for this purpose.
What method would be appropriate to use for the last one?