Versions Compared

Key

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

Table of Contents

...

When beginning a new request, we always logon and store the returned cookie for future use. In addition to the cookie, if we want to create a resource (Orgs, Locations, Credentials, Discoveries, et al) we need to provide an access token. An access token is generated with every request (except logon) and any of the last 20 (by default, settable in the configuration) will be accepted. You should always aim to use the last access token issued. An example token is in the Get Device List response, below.


Updated for Open-AudIT 3.5.4 onward on 2021-11-29.

Logon

Request

Section


URLPOSThttp://localhost/omk/open-audit/
login
logon
HeadersAcceptapplication/json
BodyTypeform-data

Keyusernameadmin

Keypasswordpassword

Response

Code Block
{
    "message": "Authenticated as user admin",
    "ok": 1
}

...


Read Devices

Logon as above, then.

Request

Section

URLGEThttp://localhost/omk/open-audit/devices
HeadersAcceptapplication/json

Response

Note - restricted to one item in the data array, normally you will retrieve all items.

...

Logon as above, then request list of devices (or any available endpoint) so we can use the meta → access_token in our request (see above response).

Request

Section


URLPOSThttp://localhost/omk/open-audit/discoveries
HeadersAcceptapplication/json
BodyTypeform-data

Keydata
    {
        "access_token": "
23652075c7660006c281bf33589620dc093bdbedf8eb7ed1223449a95748
bcb3f959c14f0daf959e3de92e4213201a56bc205e31b63f35c3f9299670",
      "type": "discoveries",
        "attributes":
 
{
      {
   
"name": "My Testing Discovery", "type
        "description": "
subnet",
Subnet 
"network_address": "http://127.0.0.1/open-audit/", "org_id": 1, "other": { "subnet": "192.169.1.0/24" } } }

Response

...

- 192.168.1.0/24",
            "match_options": "{\"match_dbus\":\"\",\"match_dns_fqdn\":\"\",\"match_dns_hostname\":\"\",\"match_fqdn\":\"\",\"match_hostname\":\"\",\"match_hostname_dbus\":\"\",\"match_hostname_serial\":\"\",\"match_hostname_uuid\":\"\",\"match_ip\":\"\",\"match_ip_no_data\":\"\",\"match_mac\":\"\",\"match_mac_vmware\":\"\",\"match_serial\":\"\",\"match_serial_type\":\"\",\"match_sysname\":\"\",\"match_sysname_serial\":\"\",\"match_uuid\":\"\"}",
            "name": "My Testing Discovery",
            "org_id": 1,
            "scan_options": "{\"exclude_ip\":\"\",\"exclude_tcp_ports\":\"\",\"exclude_udp_ports\":\"\",\"filtered\":\"\",\"id\":\"1\",\"nmap_tcp_ports\":\"\",\"nmap_udp_ports\":\"\",\"open|filtered\":\"\",\"ping\":\"\",\"service_version\":\"\",\"ssh_ports\":\"\",\"tcp_ports\":\"\",\"timeout\":\"\",\"timing\":\"\",\"udp_ports\":\"\",\"script_timeout\":\"\",\"snmp_timeout\":\"\",\"ssh_timeout\":\"\",\"wmi_timeout\":\"\"}",
          "subnet": "192.168.1.0/24",
            "type": "subnet"
      }
    }

Response

Note, generated from a discoveries read. The actual output should be almost identical.

Code Block
{
    "data":
    [
        {
            "attributes":
            {
                "ad_domain": "",
                "ad_server": "",
                "cloud_id": 1,
                "cloud_name": "",
                "command_options": "",
                "description": "Subnet - 192.168.1.0/24",
                "devices_assigned_to_location": null,
                "devices_assigned_to_org": null,
                "discard": "n",
                "duration": "00:00:00",
                "edited_by": "Administrator",
                "edited_date": "2021-11-29 13:16:53",
                "id": 3,
                "ip_all_count": 0,
                "ip_audited_count": 0,
                "ip_discovered_count": 0,
                "ip_responding_count": 0,
                "ip_scanned_count": 0,
                "last_finished": "2000-01-01 00:00:00",
                "last_run": "2000-01-01 00:00:00",
                "match_options":
                {
                    "match_dbus": "",
                    "match_dns_fqdn": "",
                    "match_dns_hostname": "",
                    "match_fqdn": "",
                    "match_hostname": "",
                    "match_hostname_dbus": "",
                    "match_hostname_serial": "",
                    "match_hostname_uuid": "",
                    "match_ip": "",
                    "match_ip_no_data": "",
                    "match_mac": "",
                    "match_mac_vmware": "",
                    "match_serial": "",
                    "match_serial_type": "",
        {            "match_sysname": "attributes":,
   {                 "descriptionmatch_sysname_serial": "Subnet",
  - 192.169.1.0/24",                 "devices_assigned_to_locationmatch_uuid": null""
                },
                "devices_assigned_to_orgname": null"My Testing Discovery",
                "discardnetwork_address": "n",
                "durationorg_id": "00:00:00"1,
                "edited_byorgs.id": "Administrator"1,
                "editedscan_dateoptions":
"2020-03-24 13:53:08",                {
  "id": 5,                 "exclude_ip_all_count": 0"",
                    "ipexclude_auditedtcp_countports": 0"",
                    "ipexclude_discoveredudp_countports": 0"",
                "ip_responding_count    "filtered": 0"",
                "ip_scanned_count    "id": 0,"1",
                    "lastnmap_tcp_finishedports": "2000-01-01 00:00:00",
                    "lastnmap_udp_runports": "2000-01-01 00:00:00",
                    "nameopen|filtered": "My",
  Testing Discovery",                 "network_addressping": "http://127.0.0.1/open-audit/",
                "options    "script_timeout": "",
                    "org_id": 1,service_version": "",
                    "orgs.idsnmp_timeout": 1"",
                    "otherssh_ports": {"",
                    "nmapssh_timeout": {
 "",
                      "discovery_scan_option_idtcp_ports": "1",
                        "exclude_ip"timeout": "",

                       "exclude_tcp_ports"timing": "",
                        "exclude_udp_ports": "",
                        "filtered"wmi_timeout": "n","
                },
                "nmapseed_tcp_portsip": "0",
       
                "nmapseed_udp_portsping": "0y",

                       "ping"seed_restrict_to_private": "y",
                "seed_restrict_to_subnet": "y",
      "service_version": "n",         "status": "",
                "ssh_portssubnet": "22192.168.1.0/24",
                "system.id": 0,
      "tcp_ports": "22,135,62078",          "system_id": 0,
                "timeouttype": "0subnet",
            },
            "timingid": "4"3,
            "links":
            {
"udp_ports": "161"               "self": "http://dev.local/omk/open-audit/discoveries/3"
    },        },
            "subnettype": "192.169.1.0/24discoveries"
        }
       }],
    "included": [],
    "issues": [],
    "statusmeta":
"",        {
        "system.idaccess_token": 0"ef4421add7e6f2741a2830a1b0262d3b678cc33efdacdd9442d5a871f474",
        "action": "read",
        "systemas_idat": 0"",

               "type"baseurl": "subnet"http://dev.local/omk/open-audit",
            }"collection": "discoveries",
            "idcurrent": 5"y",
        "data_order":
   "links": {    [
            "self": "/omk/open-audit/discoveries/5"discoveries.id",
            }"discoveries.name",
            "type": "discoveries"discoveries.org_id",
         }   "discoveries.description",
 ],     "errors": [],     "included": [],
discoveries.type",
   "links": {         "first": nulldiscoveries.subnet",
        "last": null,     "discoveries.seed_ip",
   "next": null,         "prev": nulldiscoveries.seed_restrict_to_subnet",
        "self": "http://localhost/omk/open-audit/discoveries"     }"discoveries.seed_restrict_to_private",
    "meta": {         "accessdiscoveries.seed_tokenping": "94abae66d364697699d0a44e7cfba111c769882bf832014b2ea287623650",,
           "action": "creatediscoveries.ad_domain",
           "baseurl": "http://localhost/omk/open-audit "discoveries.ad_server",
        "collection":    "discoveries.devices_assigned_to_org",
        "current": "y",    "discoveries.devices_assigned_to_location",
            "datadiscoveries.network_orderaddress":,
[             "discoveries.system_id",
            "discoveries.namescan_options",
            "discoveries.orgmatch_idoptions",
            "discoveries.descriptioncommand_options",
            "discoveries.typediscard",
            "discoveries.devices_assigned_to_orglast_run",
            "discoveries.devices_assigned_to_locationlast_finished",
            "discoveries.network_addressduration",
            "discoveries.system_idstatus",
            "discoveries.optionsip_all_count",
            "discoveries.discardip_responding_count",
            "discoveries.lastip_scanned_runcount",
            "discoveries.lastip_discovered_finishedcount",
            "discoveries.durationip_audited_count",
            "discoveries.statuscloud_id",
            "discoveries.ipcloud_all_countname",
            "discoveries.ipedited_responding_countby",
            "discoveries.ipedited_scanned_countdate",
            "discoveries.ip_discovered_countorgs.id",
            "discoveries.ip_audited_count",system.id"
        ],
     "discoveries.edited_by",   "debug": false,
        "discoveries.edited_date",
   filter": [],
        "orgs.id"filtered": 1,
            "system.id"format": "json",
            "other.subnet"groupby": "",
        "header": "HTTP/1.1 200  "other.nmap"OK",
         ]"heading": "Discoveries",
        "debugid": false3,
        "filterinclude": []"",
        "filteredlimit": ""1000,
        "formatnmap_version": "json"7,
        "groupbyoffset": ""0,
        "headerproperties": "HTTP/1.1 201 Created.*",
        "headingquery_parameters": "Discoveries"[],
        "idquery_string": 5"",
        "idsreceived_data": 0[],
        "includerequest_method": "GET",
        "limitrequestor": 1000"commercial",
        "offsetserver_app_version": "4.3.0",
        "propertiesserver_platform": "*Debian GNU/Linux 9 (stretch)",
        "query_parameterssort": []"",
        "querysub_stringresource": "",
        "received_datatimestamp": {
 "2021-11-29 13:24:45",
          "access_tokentimezone": "23652075c7660006c281bf33589620dc093bdbedf8eb7ed1223449a95748UTC +1000",
            "attributestotal": {
      1,
         "descriptionversion": "Subnet - 192.169.1.0/24",
    }
}


Update Discovery

Logon as above, then.

Request

Section


URLPATCHhttp://localhost/omk/open-audit/discoveries/5
HeadersAcceptapplication/json
BodyTypex-www-form-urlencoded

Keydata
{
   "id": 5,
  

...

"type": "

...

discoveries",
  

...

"attributes": {
     

...

"name": "

...

My New Name OMK"
   }
}

Response

Note - generated from pre 3.5.4. Attribute outputs will be as above for 3.5.4 onward.

Code Block
{
    "org_iddata": 1,[
        {
       "other": "{\"subnet\":\"192.169.1.0\\/24\",\"nmap\":{\"discovery_scan_option_id\":\"1\",\"ping\":\"y\",\"service_version\":\"n\",\"filtered\":\"n\",\"timeout\":\"0\",\"timing\":\"4\",\"nmap_tcp_ports\":\"0\",\"nmap_udp_ports\":\"0\",\"tcp_ports\":\"22,135,62078\",\"udp_ports\":\"161\",\"exclude_tcp_ports\":\"\",\"exclude_udp_ports\":\"\",\"exclude_ip\":\"\",\"ssh_ports\":\"22\"}}"     "attributes": {
                "description": "Subnet - 192.169.1.0/24",
                "devices_assigned_to_location": null,
                "devices_assigned_to_org": null,
                "discard": "n",
                "duration": "00:00:00",
                "edited_by": "Administrator",
                "edited_date": "2020-03-24 14:13:36",
                "id": 5,
                "ip_all_count": 0,
                "typeip_audited_count": "subnet"0,
            },    "ip_discovered_count": 0,
       "type": "discoveries"         }"ip_responding_count": 0,
        "request_method": "POST",
        "requestorip_scanned_count": ""0,
        "sort": "",
        "sublast_resourcefinished": "2000-01-01 00:00:00",
        "sub_resource_id": 0,         "timestamplast_run": "20202000-0301-2401 1300:5300:0800",
                "timezonename": "UTC +1000My New Name OMK",

       "total": 0,         "versionnetwork_address": 1
    }
}

Edit Discovery

Logon as above, then.

Request

...

"http://

...

{
   "id": 5,
   "type": "discoveries",
   "attributes": {
      "name": "My New Name OMK"
   }
}

Response

Code Block
{
    "data": [
        {127.0.0.1/open-audit/",
                "options": "",
                "org_id": 1,
                "orgs.id": 1,
                "attributesother": {
                    "descriptionnmap": {
  "Subnet - 192.169.1.0/24",                     "devicesdiscovery_assignedscan_tooption_locationid": null"1",
                "devices_assigned_to_org": null,         "exclude_ip": "",
      "discard": "n",                 "durationexclude_tcp_ports": "00:00:00",
                    "edited_by    "exclude_udp_ports": "Administrator",
                "edited_date        "filtered": "2020-03-24 14:13:36",n",
                        "idnmap_tcp_ports": 5"0",
                "ip_all_count        "nmap_udp_ports": "0",
                "ip_audited_count": 0,       "ping": "y",
        "ip_discovered_count": 0,
                "ipservice_responding_countversion": 0"n",
                "ip_scanned_count        "ssh_ports": 0,"22",
                        "lasttcp_finishedports": "2000-01-01 00:00:00",22,135,62078",
                   "last_run     "timeout": "2000-01-01 00:00:000",
                        "nametiming": "My New Name OMK",4",
                        "networkudp_addressports": "http://127.0.0.1/open-audit/",161"
                   "options": "" },
                "org_id": 1,     "subnet": "192.169.1.0/24"
                 "orgs.id": 1},
                "otherstatus": {"",
                    "nmap"system.id": {
     0,
                  "discoverysystem_scan_option_id": "1",
  0,
                     "exclude_ip"type": "subnet",
            },
            "exclude_tcp_portsid": ""5,
            "links": {
          "exclude_udp_ports      "self": "",/omk/open-audit/discoveries/5"
            },
            "filteredtype": "ndiscoveries",
        }
    ],
    "errors": [],
    "nmap_tcp_portsincluded": "0"[],
    "links": {
        "first": null,
        "nmap_udp_portslast": "0"null,
        "next": null,
        "prev": null,
        "pingself": "y",http://localhost/omk/open-audit/discoveries/5"
    },
    "meta": {
             "serviceaccess_versiontoken": "n47049142d113e4e316ae4219afdf54d6a6d034ff779a42fd5198a720da2e",
        "action": "update",
        "baseurl": "http://localhost/omk/open-audit",
        "ssh_portscollection": "22discoveries",
          "current": "y",
             "tcpdata_portsorder": "22,135,62078",[
            "discoveries.id",
           "timeout": "0discoveries.name",
            "discoveries.org_id",
           "timing": "4discoveries.description",
            "discoveries.type",
            "udp_ports": "161"discoveries.devices_assigned_to_org",
            "discoveries.devices_assigned_to_location",
       },     "discoveries.network_address",
            "discoveries.system_id",
  "subnet": "192.169.1.0/24"         "discoveries.options",
       },     "discoveries.discard",
           "status": "discoveries.last_run",
 
              "systemdiscoveries.id": 0,
 last_finished",
              "system_id": 0,
 "discoveries.duration",
              "type": "subnet""discoveries.status",
            }"discoveries.ip_all_count",
            "id": 5discoveries.ip_responding_count",
            "links": {
 discoveries.ip_scanned_count",
              "self": "/omk/open-audit/discoveries/5"discoveries.ip_discovered_count",
            }"discoveries.ip_audited_count",
            "type": "discoveries"discoveries.edited_by",
         }   "discoveries.edited_date",
 ],     "errors": [],     "included": [],orgs.id",
     "links": {      "system.id",
  "first": null,         "last": null,other.subnet",
            "next": null,other.nmap"
        "prev": null],
        "selfdebug": "http://localhost/omk/open-audit/discoveries/5"false,
    },     "metafilter": {[],
        "access_tokenfiltered": "47049142d113e4e316ae4219afdf54d6a6d034ff779a42fd5198a720da2e",
        "actionformat": "updatejson",
        "baseurlgroupby": "http://localhost/omk/open-audit",
        "collection": "discoveries"header": "HTTP/1.1 200 OK",
        "currentheading": "yDiscoveries",
        "data_orderid": [5,
            "discoveries.id""ids": 0,
           "include": "discoveries.name",
            "discoveries.org_id""limit": 1000,
            "discoveries.description""offset": 0,
            "discoveries.type"properties": "*",
            "discoveries.devices_assigned_to_org",
   "query_parameters": [],
        "discoveries.devices_assigned_to_location",
   query_string": "",
        "discoveries.networkreceived_addressdata",: {
            "discoveries.system_id",attributes": {
            "discoveries.options",    "id": 5,
       "discoveries.discard",         "name": "My New Name OMK"discoveries.last_run",
            "discoveries.last_finished"},
            "discoveries.duration"id": 5,
            "type": "discoveries.status","
        },
        "discoveries.ip_all_count",request_method": "PATCH",
        "requestor": "",
     "discoveries.ip_responding_count",   "sort": "",
        "discoveries.ip_scanned_countsub_resource": "",
            "discoveries.ip_discovered_count""sub_resource_id": 0,
        "timestamp":    "discoveries.ip_audited_count""2020-03-24 14:13:36",
        "timezone":    "discoveries.edited_by"UTC +1000",
        "total": 0,
  "discoveries.edited_date",      "version": 1
     "orgs.id",
   }
}



Delete Discovery

Logon as above, then.

Request

Section

URLDELETEhttp://localhost/omk/open-audit/discoveries/5
HeadersAcceptapplication/json

Response


Code Block
{
    "meta": {
        "system.idaccess_token": "530d34dc6304ebd361d088d7831e4ce9d276ac8a4826837bdf36e8e84c87",
            "other.subnet"action": "delete",
            "other.nmap""baseurl": "http://localhost/open-audit/",
        ] "collection": "discoveries",
        "debugcurrent": false"y",
        "filterdebug": []false,
        "filtered": "",
        "format": "json",
        "groupby": "",
        "header": "HTTP/1.1 200 OK",
        "id": 5,
        "headingids": 0,
        "include": "Discoveries",
        "idlimit": 51000,
        "idsoffset": 0,
        "includeproperties": "*",
        "limitquery_string": 1000"",
        "offsetrequest_method": 0"DELETE",
        "propertiesrequestor": "*",
        "query_parameterssort": []"",
        "querysub_stringresource": "",
        "receivedsub_resource_data": {
 id": 0,
          "attributestotal": 0,
{        "timestamp": "2020-03-24 14:22:38",
        "idtimezone": 5 "UTC +1000",
        "version": 1,
        "namefilter": "My[],
New Name OMK"      "query_parameters": [],
     },   "received_data": [],
        "idheading": 5"Discoveries",
            "type"data_order": []
"discoveries"    },
    },"links": {
        "request_methodself": "PATCHhttp://localhost/open-audit/index.php/discoveries/5",
        "requestorfirst": ""null,
        "sortlast": ""null,
        "sub_resourcenext": ""null,
        "sub_resource_idprev": 0null
    },
    "included": [],
    "timestampdata": "2020-03-24 14:13:36",[
        {
 "timezone": "UTC +1000",         "totaltype": 0,"discoveries"
        "version": 1}
    }]
}