i have a rather general question: How to call a method in RESTful web service correctly?
The method is supposed to do only a transformation in the database and return nothing (so no GET?!). However I also send no values from the client (so no PUT/POST?!?).
So far I am using GET. Put i read thats not the proper way to do it...
Thanks in advance!
REST stands for "REpresentational State Transfer". If you're not transferring state representing the thing you're working with (in one direction or the other), it's pretty much inherently not RESTful, and there's no correct way of doing it and still calling it REST.
If you want RPC, then do RPC. Just don't call it RESTful. :)
The way you do it is through RPC. REST is good for state transfer, but not for triggering actions that have nothing to do with state transfer, such as operations that affect a large number of records. Most systems I've seen use REST for 99% of the work in supporting a UI, and RPC for that last 1% -- operations that do not involve state transfer, bulk update operations, that sort of thing. Your goal should be to express as much of the business logic as possible as reaction to application of state, reserving the corner cases for RPC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With