Tenable.sc API: Agent Scan

 

/agentScan

Methods
GET

Gets the list of Agent Scans.

Fields Parameter
Expand

The fields parameter should be specified along the query string, and it takes the syntax

    ?fields=<field>,...

Allowed Fields

*id
**name
**description
**status
nessusManager
repository
scanWindow
agentGroups
createdTime
modifiedTime
ownerGroup
creator
owner
reports
schedule


Legend

* = always comes back

** = comes back if fields list not specified on GET all

redFont =  field is a JSON object e.g. "repository" :{ "id" : <id>, "name" : <name> } )

Request Parameters

None

Expand Parameters

credentials

Filter Parameters

usable - The response will be an object containing an array of usable Agent Scans. By default, both usable and manageable objects are returned.
manageable - The response will be an object containing all manageable Agent Scans. By default, both usable and manageable objects are returned. 

Example Response
Expand
{
	"type" : "regular",
	"response" : {
		"usable" : [
			{
				"id" : "2",
				"name" : "Agent Scan #1",
				"description" : ""
			},
			{
				"id" : "3",
				"name" : "Agent Scan #2",
				"description" : ""
			},
			{
				"id" : "4",
				"name" : "Agent Scan #3",
				"description" : "Description for Agent Scan #3"
			}
		],
		"manageable" : [
			{
				"id" : "2",
				"name" : "Agent Scan #4",
				"description" : ""
			},
			{
				"id" : "3",
				"name" : "Agent Scan #5",
				"description" : ""
			},
			{
				"id" : "4",
				"name" : "Agent Scan #6",
				"description" : "Description for Agent Scan #6"
			}
		]
	},
	"error_code" : 0,
	"error_msg" : "",
	"warnings" : [],
	"timestamp" : 1406828340
}

POST

Adds an Agent Scan, depending on access and permissions.

Request Parameters
Expand
{
	"name" : <string>,
	"type" : <string> "plugin" | "policy",
	"description" : <string> DEFAULT "",
	"nessusManager" : {
		"id" : <number>
	},
	"repository" : {
		"id" : <number>
	},
	"scanWindow" : <string> DEFAULT "60",
    "agentGroups" : {
        "id" : <number>,
        "name" : <string>,
		"description" : <string>,
    },
	"schedule" : {
		"type" : "ical" | "never" | "rollover" | "template" <string> DEFAULT "template",
	},
	"reports" : [
		{
			"id" : <number>,
			"reportSource" : <string> "cumulative" | "individual"
		}...
	] DEFAULT []
}


schedule type is "ical"

...
	"schedule" : {
		"start" : <string> (This value takes the iCal format),
		"repeatRule" : <string> (This value takes the repeat rule format)
	}
...
Example Response
Expand
{	
	"type" : "regular",
	"response" : {	
		"id" : "4",
		"creatorID" : "1",
		"ownerID" : "1",
		"name" : "POSTtest",
		"description" : "This is a test for POST",
		"status" : "0",
        "scanWindow" : 60,
		"agentGroup" : {
			"id" : 5,
			"name" : "Nessus Manager",
			"description" : ""
		},
		"createdTime" : "1406815242",
		"modifiedTime" : "1406815242",
		"reports" : [],
        "schedule" : {
            "type" : "never",
            "start" : "",
            "repeatRule" : ""
        },
		"creator" : {	
			"id" : "1",
			"username" : "head3",
			"firstname" : "",
			"lastname" : ""
		},
		"owner" : {	
			"id" : "1",
			"username" : "head3",
			"firstname" : "",
			"lastname" : ""
		},
		"nessusManager" : {
			"id" : "1",
			"name" : "test manager",
			"description" : ""
		},
		"repository" : {
			"id" : "2",
			"name" : "test",
			"description" : "test"
		},
		"ownerGroup" : {	
			"id" : "0",
			"name" : "Full Access",
			"description" : "Full Access group"
		}
	},
	"error_code" : 0,
	"error_msg" : "",
	"warnings" : [],
	"timestamp" : 1406815242
}

/agentScan/{id}

Methods
GET

Gets the Agent Scan associated with {id}.

Fields Parameter
Expand

The fields parameter should be specified along the query string, and it takes the syntax

    ?fields=<field>,...

Allowed Fields

*id
**name
**description
**status
nessusManager
repository
scanWindow
agentGroup
createdTime
modifiedTime
ownerGroup
creator
owner
reports
schedule

Legend

* = always comes back

** = comes back if fields list not specified on GET all

redFont =  field is a JSON object e.g. "repository" :{ "id" : <id>, "name" : <name> } )

Request Parameters

None

Expand Parameters

credentials

Example Response
Expand
{
	"type" : "regular",
	"response" : {
		"id" : "4",
		"name" : "Agent Scan",
		"description" : "Agent Scan Description",
		"scansWindow" : 60,
		"agentGroup" : {
			"id": 3,
			"name" : "Agent Group",
			"description" : "Description"
		},
		"emailOnLaunch" : "false",
		"emailOnFinish" : "false",
		"status" : "0",
		"createdTime" : "1406815242",
		"modifiedTime" : "1406815242",
		"reports" : [],
		"schedule" : {
            "type" : "never",
            "start" : "",
            "repeatRule" : ""
        },
		"nessusManager" : {
			"id" : "1",
			"name" : "test manager",
			"description" : ""
		},
		"repository" : {
			"id" : "2",
			"name" : "test",
			"description" : "test"
		},
		"ownerGroup" : {
			"id" : "0",
			"name" : "Full Access",
			"description" : "Full Access group"
		},
		"creator" : {
			"id" : "1",
			"username" : "head3",
			"firstname" : "",
			"lastname" : ""
		},
		"owner" : {
			"id" : "1",
			"username" : "head3",
			"firstname" : "",
			"lastname" : ""
		}
	},
	"error_code" : 0,
	"error_msg" : "",
	"warnings" : [],
	"timestamp" : 1406828664
}

PATCH

Edits the Agent Scan associated with {id}, changing only the passed in fields.

Request Parameters

(All fields are optional)

See /agentScan::POST for parameters.

Example Response
See /agentScan/{id}::GET

DELETE

Deletes the Agent Scan associated with {id}, depending on access and permissions.

Request Parameters

None

Example Response
Expand
{
	"type" : "regular",
	"response" : "",
	"error_code" : 0,
	"error_msg" : "",
	"warnings" : [],
	"timestamp" : 1406732180
}

/agentScan/{id}/launch

Methods
POST

Launches the Agent Scan associated with {id}.

Request Parameters

None

Example Response
Expand
{
	"type" : "regular",
	"response" : {
		"scanID" : -1,
		"resultsSyncID" : "-1",
		"agentScanID" : "7",
		"repositoryID" : "14",
		"jobID" : "93484",
		"name" : "Agent Scan",
		"description" : "",
		"details" : "",
		"status" : "Queued",
		"importStatus" : "No Results",
		"downloadFormat" : "v2",
		"dataFormat" : "IPv4",
		"resultType" : "agents",
		"running" : false,
		"errorDetails" : "",
		"importErrorDetails" : "",
		"totalIPs" : -1,
		"scannedIPs" : 0,
		"startTime" : -1,
		"finishTime" : 0,
		"id" : "45"
	},
	"error_code" : 0,
	"error_msg" : "",
	"warnings" : [],
	"timestamp" : 1442339263
}