Jump to: navigation, search

Difference between revisions of "Obsolete:Glance-api-v2-links"

Line 65: Line 65:
 
   "prev": "?marker=10&limit=10",
 
   "prev": "?marker=10&limit=10",
 
   "next": "?marker=30&limit=10",
 
   "next": "?marker=30&limit=10",
   "last": "?limit=10&sort_dir=desc"
+
   "last": "?limit=10&sort_dir=desc",
 +
  "schema": "/images/schema"
 
}
 
}
 
</nowiki></pre>
 
</nowiki></pre>

Revision as of 03:54, 30 May 2012

Glance v2 api links

Rationale

The jsonschema draft document specifies link description objects as part of a schema document. A link description object defines a format for inferring link relations from the attributes of a document that is an instance of such a schema. Instead of following this format, the present glance v2 api follows the openstack compute api example of embedding link description objects directly in non-schema documents. This blueprint proposes changing version two of the glance api to adopt the jsonschema canonical approach.

Schemas and Examples

Images Schema

GET /images/schema
{
  "name": "images",
  "properties": {
    "images": {
      "type": "array",
      "items": {
        "extends": "http://glance/v2/schemas/image"
      }
    },
    "first": {"type": "string"},
    "prev": {"type": "string"},
    "next": {"type": "string"},
    "last": {"type": "string"},
    "schema": {"type": "string"}
  },
  "links": [
    {
      "rel": "first",
      "href": "{first}"
    },
    {
      "rel": "prev",
      "href": "{prev}"
    },
    {
      "rel": "next",
      "href": "{next}"
    },
    {
      "rel": "last",
      "href": "{last}"
    },
    {
      "rel": "describedby",
      "href": "{schema}"
    }
  ]
}


Images Response Example

GET /images?marker=20&limit=10
{
  "images": [
    ...
  ],
  "first": "?limit=10",
  "prev": "?marker=10&limit=10",
  "next": "?marker=30&limit=10",
  "last": "?limit=10&sort_dir=desc",
  "schema": "/images/schema"
}