[openstack-dev] [TripleO][Tuskar] JSON output values from Tuskar API

Petr Blaho pblaho at redhat.com
Wed Feb 26 18:38:21 UTC 2014


Hi,

I am wondering what is the OpenStack way of returning json from
apiclient.

I have got 2 different JSON response examples from http://api.openstack.org/:

json output with namespace:
{
  "volume":
  {
    "status":"available",
    "availability_zone":"nova",
    "id":"5aa119a8-d25b-45a7-8d1b-88e127885635",
    "name":"vol-002",
    "volume_type":"None",
    "metadata":{
      "contents":"not junk"
    }
  }
}
(example for GET 'v2/{tenant_id}/volumes/{volume_id}' of Block Storage API v2.0 taken from
http://api.openstack.org/api-ref-blockstorage.html [most values ommited])

json output without namespace:
{
  "alarm_actions": [
      "http://site:8000/alarm"
    ],
    "alarm_id": null,
    "combination_rule": null,
    "description": "An alarm",
    "enabled": true,
    "type": "threshold",
    "user_id": "c96c887c216949acbdfbd8b494863567"
}
(example for GET 'v2/alarms/{alarm_id}' of Telemetry API v2.0 taken from
http://api.openstack.org/api-ref-telemetry.html [most values ommited])

Tuskar API now uses "without namespace" variant.

By looking at API docs at http://api.openstack.org/ I can say that
projects use both ways, altought what I would describe as "nicer API"
uses namespaced variant.

So, returning to my question, does OpenStack have some rules what
format of JSON (namespaced or not) should APIs return?

-- 
Petr Blaho, pblaho at redhat.com
Software Engineer



More information about the OpenStack-dev mailing list