Upload Scan - API

/rest/{version}/applications/{appId}/upload

Descriptor

Value

HTTP Method

POST

Description

Uploads and processes the scan.

Required Permission

Upload Scans

Version Introduced

2.3.0

Changes in 2.4.5

Starting with Version 2.4.5, this call adds the scan to the Scan Upload Queue, and returns an entirely different response. 

The scan has not finished importing into an application at the time the call returns; if you have automation using this call,

make sure to use the legacy version or adjust your automation accordingly.

Changes in 2.5

The new Links section includes a link to the endpoint you can hit to check the status of the scan after it’s been added to the queue.

Request Header Parameters

Parameter

Value

Required

Description

Accept

String

Yes

A value of ‘application/json’ must be provided.

Request POST Data Parameters

Parameter

Value

Required

Description

file

File

yes

The scan you want to upload to the application in ThreadFix.

Format: file=@path/to/file

  • Must precede the file path with the @ symbol)

  • Windows: use double backslashes in the path, e.g., C:\\path\\to\\file.ext

Sample Call:

1 curl --insecure -H 'Accept: application/json' -H "Authorization: APIKEY {apiKey}" -X POST --form file=@path/to/file/www_example_url_com_webinspect_scan.xml http://localhost:8080/threadfix/rest/latest/applications/2/upload

Sample Output (v2.4.5 through latest):

1 2 3 4 5 6 7 8 9 10 11 12 13 {     "message": "",     "success": true,     "responseCode": -1,     "object": "Scan upload process started.",     "links": [         {             "method": "GET",             "rel": "related",             "href": "http://localhost:8080/threadfix/rest/applications/2/pendingScan/39/status"         }     ] }

Sample Output (legacy through v2.4.2.1):

Values for importTime are returned as Epoch time in milliseconds.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 {     "message": "",     "success": true,     "responseCode": -1,     "object": {         "id": 2,         "importTime": 1320440009000,         "numberClosedVulnerabilities": 0,         "numberNewVulnerabilities": 29,         "numberOldVulnerabilities": 0,         "numberResurfacedVulnerabilities": 0,         "numberTotalVulnerabilities": 29,         "numberRepeatResults": 0,         "numberRepeatFindings": 0,         "numberInfoVulnerabilities": 1,         "numberLowVulnerabilities": 14,         "numberMediumVulnerabilities": 6,         "numberHighVulnerabilities": 2,         "numberCriticalVulnerabilities": 6,         "findings": [             {                 "id": 3,                 "longDescription": null,                 "attackString": "",                 "attackRequest": "GET /demo/XSS-reflected2.php HTTP...", //SHORTENED FOR BREVITY                 "attackResponse": "HTTP/1.1 200 OK\nDate: Fri, 04 Nov 201...", //SHORTENED FOR BREVITY                 "nativeId": "c9522bf8c67a646f5979cc2212710195",                 "displayId": null,                 "surfaceLocation": {                     "id": 3,                     "parameter": null,                     "path": "/demo/XSS-reflected2.php"                 },                 "sourceFileLocation": null,                 "dataFlowElements": null,                 "calculatedUrlPath": "/demo/XSS-reflected2.php",                 "calculatedFilePath": "",                 "dependency": null,                 "severity": "1",                 "vulnerabilityType": "Possible Server Path Disclosure (win32)"             },             {                 "id": 4,                 "longDescription": null,                 "attackString": "",                 "attackRequest": "GET /demo/LDAPInjection2.php HTTP/1.1\nRe...", //SHORTENED FOR BREVITY                 "attackResponse": "HTTP/1.1 200 OK\nDate: Fri, 04 Nov 2011 20:...", //SHORTENED FOR BREVITY                 "nativeId": "6d5dc848529d28f8ab89cc20e6ca413d",                 "displayId": null,                 "surfaceLocation": {                     "id": 4,                     "parameter": null,                     "path": "/demo/LDAPInjection2.php"                 },                 "sourceFileLocation": null,                 "dataFlowElements": null,                 "calculatedUrlPath": "/demo/LDAPInjection2.php",                 "calculatedFilePath": "",                 "dependency": null,                 "severity": "1",                 "vulnerabilityType": "Possible Server Path Disclosure (win32)"             },             //THE REST OMITTED FOR BREVITY         ],         "scannerName": "WebInspect"     } }