[ 
https://issues.apache.org/jira/browse/RAVE-1048?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13751354#comment-13751354
 ] 

Rohit Kalkur commented on RAVE-1048:
------------------------------------

{color:red}
_At the end of the day this is a relatively harmless change but let me ask this 
question. I can almost guarantee at some point we'll have to have different 
logic for a create vs an update (validation, permissions...). Assuming for a 
second that is true, wouldn't you need to have a different method on the 
resource anyway (or at least know you are doing a create vs update somewhere 
and could call a different method)?_
{color}

The way we would differentiate between an update versus a create would be 
through the URL structure itself.

For example, lets say our resource is Pages. To create a new page, we would map 
to all POST requests with the following route structure:

POST /api/pages/

and for an update to the page with id = 4, we would map to the following:

POST /api/pages/4


                
> Have update rest methods accept both put and post requests.
> -----------------------------------------------------------
>
>                 Key: RAVE-1048
>                 URL: https://issues.apache.org/jira/browse/RAVE-1048
>             Project: Rave
>          Issue Type: Sub-task
>          Components: rave-core
>            Reporter: Erin Noe-Payne
>             Fix For: 0.23
>
>
> Angular's $resource service uses post methods to save new or updated 
> resources. For simplicity, we should update the rest api endpoints so that 
> update methods accept PUT or POST requests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to