문제

I've been under the impression that Post in Rest means "Create". But after reading up on the spec http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.5

It seems like it can be more than just Create? That was also stated by Stormpath in their screencasts on rest api design.

According to Stormpath, Post means "Process" , which can be pretty much anything. Is that the correct way to see it?

I can trigger custom actions for my resources using Post?

도움이 되었습니까?

해결책

In theory, a POST request should attempt to create or modify some resource on the server. As @Tichodroma pointed out, an idempotent request will affect this change only the first time it is sent, but otherwise what's important is that some state on the server will be changed by the request.

More practically. POST requests are often used when the request payload is too large to fit into a GET URI (e.g. a large file upload). This is usually an intentional breach of HTTP standards to avoid a 414 Request-URI Too Long response.

In terms of verbiage, I don't know if I like "process", because even a GET request will usually be "processed" to determine the resource to return. The main difference in my mind is the change of some state on the server.

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