comanage-dev - [comanage-dev] Re: [JIRA] Work started: (CO-119) REST PUT
Subject: COmanage Developers List
List archive
- From: Benn Oshrin <>
- To: Marie Huynh <>
- Cc: comanage-dev <>
- Subject: [comanage-dev] Re: [JIRA] Work started: (CO-119) REST PUT
- Date: Thu, 20 Oct 2011 15:37:38 -0400
Bringing this back to -dev since Scott started this thread originally...
Out of the box, Cake will map POST to add() and POST or PUT to edit, depending on the URL format. So to make the switch described in the ticket, I'm not sure we actually need to change anything technically, just the documentation. (There wasn't any particular reason I started with POST instead of PUT.)
So, should we?
Well, if we follow the guide described in wikipedia
http://en.wikipedia.org/wiki/Representational_State_Transfer#RESTful_web_services
the answer is yes, since PUT on an element replaces it, whereas POST on an element creates a new entry under the existing one.
Another metric is idempotency (PUT is, POST isn't). In general, our edit operations are idempotent (and if they aren't perhaps they shouldn't be 'edit' operations), and so by this standard the answer is also yes.
So I'd suggest
(1) We update the documentation so all edit operations are PUT
(2) We verify that all update operations are in fact idempotent
(3) We test to make sure PUT requests are handled correctly
(4) We disable POST for edits
Thoughts?
-Benn-
PS> What do you mean by "submit an edit form"? The web UI doesn't use the REST API.
On 10/19/11 10:19 PM, Marie Huynh wrote:
Benn,
Why did you initially choose POST for add and edit and why is edit now
PUT? I'm trying to figure out what of the mapResources() in
app/config/routes.php I can keep or if I should rewrite all of them.
I'm not sure why cake/libs/router.php has two lines for edit, but
changing the second to PUT doesn't seem to change what's being used
when I submit an edit form either:
98 /**
99 * Default HTTP request method => controller action map.
100 *
101 * @var array
102 * @access private
103 */
104 |___var $__resourceMap = array(
105 |___|___array('action' => 'index',|_'method' => 'GET',|_|___'id' =>
false),
106 |___|___array('action' => 'view',|__'method' => 'GET',|_|___'id' =>
true),
107 |___|___array('action' => 'add',|___'method' => 'POST',||___'id' =>
false),
108 |___|___array('action' => 'edit',|__'method' => 'PUT', ||___'id' =>
true),
109 |___|___array('action' => 'delete',|'method' => 'DELETE',|__'id' =>
true),
110 |___|___array('action' => 'edit',|__'method' => 'PUT', |'id' => true)
111 |___);
Marie
On Fri, Oct 14, 2011 at 10:44 AM, Marie Huynh (JIRA)
<>
wrote:
[
https://bugs.internet2.edu/jira/browse/CO-119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CO-119 started by Marie Huynh.
REST PUT
--------
Key: CO-119
URL: https://bugs.internet2.edu/jira/browse/CO-119
Project: COmanage
Issue Type: New Feature
Components: Registry
Reporter: Benn Oshrin
Assignee: Marie Huynh
Fix For: COmanage Registry 0.3 (Basic Shape)
'PUT' when doing an edit on an existing resource instead of POST.
(POST to create or add, PUT to modify or edit)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
- [comanage-dev] Re: [JIRA] Work started: (CO-119) REST PUT, Benn Oshrin, 10/20/2011
- Re: [comanage-dev] Re: [JIRA] Work started: (CO-119) REST PUT, Scott Koranda, 10/20/2011
- Re: [comanage-dev] Re: [JIRA] Work started: (CO-119) REST PUT, Marie Huynh, 10/26/2011
- Re: [comanage-dev] Re: [JIRA] Work started: (CO-119) REST PUT, Scott Koranda, 10/20/2011
Archive powered by MHonArc 2.6.16.