[katello-devel] calling update on an object in api/v2

Eric Helms ehelms at redhat.com
Wed Sep 25 12:36:58 UTC 2013


My opinion is the use of option #1 but using snakecase parameters, i.e. {field_name: 'name'}
While I understand the Rails convention around root nodes, I am not fully convinced the Rails convention meets well with the convention used by other RESTful services. As far as I understand REST, a resource retrieved from the server should be put back to the server in the same format. This means that for parameters, if I receive {field_name: 'name'} and make changes, I should be able to put the resource back with changes via {field_name: 'new name'}. If we include a root node for the POST/PUT actions, then it should also be present in the GET actions. I think this discussion is better served here: https://groups.google.com/forum/?fromgroups#!topic/foreman-dev/7FcYnp060I0


- Eric

----- Original Message -----
> From: "Brad Buckingham" <bbuckingham at redhat.com>
> To: katello-devel at redhat.com
> Sent: Tuesday, September 24, 2013 4:15:21 PM
> Subject: Re: [katello-devel] calling update on an object in api/v2
> 
> On 09/24/2013 04:01 PM, Tom McKay wrote:
> > What should the "params" be when updating an object in v2?
> >
> > Option #1 (current method):
> > params = { a:1, b:2 }
> >
> > Option #2:
> > params = { object: { a:1, b:2 } }
> >
> > The nunu systems page sends up option #1
> >
> > _______________________________________________
> > katello-devel mailing list
> > katello-devel at redhat.com
> > https://www.redhat.com/mailman/listinfo/katello-devel
> 
> I would think it should be option 2.
> 
> Another question that we discussed just briefly in irc this afternoon is:
> 
> What case should be used in the request params?
> 
> Option #1
> params = { someObject: { fieldName: xyz } }
> 
> Option #2
> params = { some_object: { field_name: xyz } }
> 
> I'd assume option 2, but it looks like we might be heading towards using
> option 1.
> 
> thanks,
> Brad
> 
> _______________________________________________
> katello-devel mailing list
> katello-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/katello-devel
> 




More information about the katello-devel mailing list