Jump to: navigation, search

Nova/APIStyleGuide

< Nova
Revision as of 03:24, 18 November 2013 by Christopher Yeoh (talk | contribs) (Initial guidelines)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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
  • 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