I am designing a RESTfull system that is used by a web site to submit application forms and then used by an internal tool to authorise or decline thos applications. I have having a debate in my head around how to constuct this and have two options. PUT or POST.
PUT option
Applications are all listed under and application resource that can be filtered by a state code (new, approved, declined) using a query parameter (the states exposed through a different resource). New Applicatons can be posted to this URL which creates them and assigns and ID. You can then access the application with a GET using its ID. To approve, you PUT one of the statecodes to the application URL to update the record.
GET Service.svc/statecodes
GET POST Service.svc/Applications?statecode={statecode} /{POST DATA}
GET PUT Service.svc/Applications/{applicationId} statecode={statecode}
POST OPTION
Applications are all listed under and application resource, new Applicatons can be posted to this URL which creates them and assigns and ID. There are different URLs which show filtered views of the applications: pending, approved, declined. To approve an applicationId would be posted to the approved URL and to decline the URL would be posted to the declined url. These last two posts would have the effect or moving an application from the the pending list and into the approved list.
POST Service.svc/Applications form={POST DATA}
GET Service.svc/Applications/{applicationId}
GET Service.svc/Applications/pending
GET POST Service.svc/Applications/approved applicationId={applicationId}
GET POST Service.svc/Applications/declined applicationId={applicationId}
The PUT method seems the most RESTful to me, but exposes behaviour to the outside world and breaks encapsulation. The POST method seems cleaner and more discoverable but i don't like the side effects of the POST to a resource on another resource.
I feel that actually we should be using SOAP for the approve and decline as it is a command/message rather than a query which is really what REST is all about, but i'm stuck on a path from high above unless someone can help me form an argument for SOAP.
So which is the right or best approach?