Question

I have the following REST API:

POST /users/martin/notify/...

The API is suppose to notify a list of users that the user Martin has something to say. The list of users to be notified can vary from 1 to a thousand. Where the list of a thousand users should be: Querystring, HTTP Header or the Request body? Why?

Was it helpful?

Solution

Request body. Headers and querystrings often have size limitations in practice that you would definitely hit with a thousand identifiers. At a more theoretical level, the request body should be the entity which you wish the server to process via POST. Headers are for protocol-level metadata about that entity; that is, information that helps the entity be processed, but not the entity itself. Querystrings are part of the identifier for the resource, and also not a representation of that resource.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top