Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When requesting the details fo a resource (a device), if the request is JSON based only the 'system' table will be returned. NOT all the related tables. There will be links for these tables in the data->links section. If you would like the system tabel AND the bios table (for example) in a JSON request, you can use the 'include' keyword. An example would be a GET request with accept header as JSON to http://server/open-audit/index.php/devices?include=bios. For a HTML (web browser) formatted request, by default all related tables are included so the web page can render the device details as it has always done. When using include, you can use the keyword 'all' to retrieve all tables that contain related information.

Code Block
include={sub_resource}

...

Request Methodidactionsub_resourcesub_resource_idResulting ActionNotesURL Example
GETN<empty>  collection /devices
GETNcreate  create_form /devices?action=create
GETY/NcreateY sub_resource_create_form /devices?action=create&sub_resource=credentials
GETNimport  import_form /devices?action=import
GETY   read /devices/{id}
GETYupdate  update_form /devices/{id}?action=update
GETYdownload  download /scripts/{id}?action=download
GETNupdate  bulk_update_form

Should provide attribute "ids" which is a comma

separated list of ID's upon which to bulk update.

/devices?action=update&ids=1,2,3,4
POSTN   create /devices
POSTNimport  import /devices?action=import
POSTNedit  bulk_update_form  
POST / PUT / PATCHY<empty>  update /devices/{id}?action=update
POSTY Y sub_resource_create /devices/{id}?sub_resource=credential
DELETEY N delete /scripts/{id}
DELETEY YYsub_resource_delete /devices/{id}/credential/{sub_resource_id}
ALL <empty> / list  collection  
        
        
        
        

 

 

Devices

...

Examples of retrieving data

HTTP VerbAcceptURLResultExample Response
GETJSON/devicesGet a list of all devices.devices.json
GETJSON/devices/8Get the system table of device with id = 8.devices_8.json
GETJSON/devices/8&include=biosGet the system table and bios table for device with ID = 8.devices_8_include_bios.json
     

Examples of updating a device

HTTP VerbAcceptURLDataResultExample Response
PATCHJSON/devices/8
Code Block
languagejs
{
"data": {
    "type" : "devices",
    "id" : 8,
    "attributes" : {
        "description" : "my HP"
        }
    }
}
Update the type attribute of the device with ID = 8.devices_8_patch_description.json
      
      

 

Device sub_resource Names

...