[openstack-dev] [api] Requesting opinion/guideline on IDs vs hrefs

Kevin L. Mitchell kevin.mitchell at rackspace.com
Mon Nov 17 20:03:18 UTC 2014

On Mon, 2014-11-17 at 19:47 +0000, Shaunak Kashyap wrote:
> Poppy APIs refer to a flavor in their request and/or response
> representations. Some representations do this by using the flavor ID
> (e.g. 12345) while others use the flavor resource URI (e.g.
> {base}/flavors/12345).
> In this context, I created a bug[2] to settle on one way of referring
> to a flavor across all API representations in Poppy. So the question
> to the API working group is this:
> How should flavors be referred to in Poppy API representations? Some
> options to consider:
> a) Using a “flavor_id” (or similar) property whose value is the flavor
> ID (e.g. 12345),
> b) Using a “flavor_ref” (or similar) property whose value is the
> flavor resource URI (e.g. {base}/flavors/12345),
> c) Using a “links” property whose value is an array of links, one of
> which has an object like { “rel”: “flavor”, “href”:
> “{base}/flavors/12345” },
> d) Similar to c) but using HAL[3] instead,
> e) A combination of a) and c),
> f) A combination of a) and d),
> g) Something else?

I can't think of any API in OpenStack that uses a URI for referencing
anything.  We may have *links* in the payloads, but those are provided
for convenience; anytime nova refers to a flavor, it returns the flavor

I would, by the way, suggest using UUIDs rather than plain IDs, for
consistency with the rest of the APIs…
Kevin L. Mitchell <kevin.mitchell at rackspace.com>

More information about the OpenStack-dev mailing list