RESTful API Resources

Steve Loranz sloranz at redhat.com
Fri Nov 9 15:09:28 UTC 2012


I'm not sure how concerned you are with being able to translate between the two, but I've found it much easier to do by not using attributes in the XML and just treating it as plain key/value pairs.

-steve

On Nov 9, 2012, at 2:30 AM, Dmitri Dolguikh <dmitri at redhat.com> wrote:

> On 08/11/12 04:00 PM, Steve Loranz wrote:
>> What does the JSON version of that resource look like?
> pls. see below.
> 
>>> or, going a bit farther:
>>> 
>>> <instance>
>>>  <state href="instances/1111/state">
>>>    <value>REBOOTING</value>
>>>    <actions>
>>>      <link rel="next" href="instances/1111/state/next">
>>> 
>>> this way the xml for expressing of available operations will be consistent across all resources. Alternatively, the state could be changed by PUTting one of the available states into the 'state' field of the 'instance' resource.
>>> 
>>> State itself could either be a child resource of 'instance' if it's 'instance'-specific, or a root-level resource otherwise.
>>> 
>>> -d
> 
> or, the same in json:
> "instance": {
>  "state" : {
>    "href" : "instances/1111/state",
>    "value": "REBOOTING"
>    "actions" : [{"link" : { "rel" : "next", "href" : "instances/1111/state/next" }}]
> 




More information about the aeolus-devel mailing list