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

Shaunak Kashyap shaunak.kashyap at RACKSPACE.COM
Mon Nov 17 19:47:11 UTC 2014


Hi,

I’ve been working with the Poppy project[1] while they are designing their APIs. Poppy has a concept of a flavor. A single flavor resource has the URI, {base}/flavors/{flavor_id}. 

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?

Thanks,

Shaunak

References:
[1] https://wiki.openstack.org/wiki/Poppy
[2] https://bugs.launchpad.net/poppy/+bug/1392573
[3] https://github.com/mikekelly/hal_specification/blob/master/hal_specification.md


More information about the OpenStack-dev mailing list