문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top