Difference between revisions of "Nova/APIStyleGuide"
< Nova
(Initial guidelines) |
(No difference)
|
Latest revision as of 03:24, 18 November 2013
API Style Guide
This primarily applies to the V3 API, but should be followed for V2 API changes where it makes sense
- Alias names for extensions
- Should be of the form foo-bar
- lowercase, no contractions
- Non core extension names should be prefixed with os-, eg os-access-ips
- Should be of the form foo-bar
- Use snake_case not CamelCase for body method parameters
- Use server rather than instance for the API
- When extending existing resources, new parameters (input and output) should use the new extension's alias as a prefix
- eg where config drive extends the server response
"server": { "os-config-drive:config_drive": "%(cdrive)s", "addresses": { "private": [ { "addr": "%(ip)s", "mac_addr": "aa:bb:cc:dd:ee:ff", "type": "fixed", "version": 4 } ] },
- Do not use WebDav HTTP error codes (eg 422 Unprocessable entity)
- Ensure the layout of the XML input/output format is consistent with the JSON input/output format