As of December 31st, 2023 ThreadFix 2.X has reached End of Life and is no longer supported. For any further information please contact the Success and Implementation team.

Complete Task - API

/rest/{version}/tasks/completeTask

Descriptor

Value

HTTP Method

POST

Description

Marks a task as completed and uploads the scan file to the task’s application.

Required Permission

Manage Scan Agents

Version Introduced

2.4.0

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

scanQueueTaskId

Integer

Yes

ID for the Scan Agent Task to mark as complete.

file

File

Yes

The File to upload to ThreadFix

scanAgentSecureKey

String

Yes

A Secure Scan Agent Key obtained from the “Request Scan Agent Key” call.  Must be the same one used to assign the Task from the queue.

secureTaskKey

String

Yes

The Secure Task Key that was returned when the Task was assigned from the queue.

Sample Call:

curl --insecure -H 'Accept: application/json' -H "Authorization: APIKEY {apiKey}" -X POST -F 'scanQueueTaskId=1' -F 'scanAgentSecureKey=yMFCvtcmBtAARYS5QX8x54zvMruNLIvNMzqMI44K4JG8' -F 'secureTaskKey=KVS1TiifaYeILnchqbdmU24JEyljgNy0NTOgvSLzS3Y' -F 'file=@C:/path/to/scanResults.xml' http://localhost:8080/threadfix/rest/latest/tasks/completeTask

Sample Output:

Values for createTime, startTime, endTime, timeoutTime, and uploadedDate are returned as Epoch time in milliseconds.

{     "message": "",     "success": true,     "responseCode": -1,     "object": {         "id": 1,         "active": true,         "scanStatuses": [             {                 "id": 1,                 "active": true,                 "message": "Scan queued at: 28-09-16:15:25:893 -0500"             },             {                 "id": 2,                 "active": true,                 "message": "Assigning task to an agent with agentConfig:\nC:\\ThreadFix\\scanagent\\scanagent.properties"             },             {                 "id": 4,                 "active": true,                 "message": "This task is still in progress"             },             {                 "id": 5,                 "active": true,                 "message": "This task is still in progress"             },             {                 "id": 6,                 "active": true,                 "message": "Scan completed successfully at: 28-09-16:16:40:957 -0500"             }         ],         "scanner": "Burp Suite Pro",         "version": null,         "createTime": 1475094356000,         "startTime": 1475094996000,         "endTime": 1475098826957,         "timeoutTime": 1475137556000,         "status": 3,         "scanAgentInfo": null,         "secureKey": "KVS1TiifaYeILnchqbdmU24JEyljgNy0NTOgvSLzS3Y",         "scanAgentInstanceSecureKey": "yMFCvtcmBtAARYS5QX8x54zvMruNLIvNMzqMI44K4JG8",         "scanConfig": {             "id": 1,             "active": true,             "name": "burp",             "type": "scanagtcfg",             "contentType": "application/octet-stream",             "uploadedDate": 1475094354000         },         "targetUrl": "http://targeturl/app",         "taskStatus": "STATUS_COMPLETE_SUCCESSFUL",         "scannerShortName": "burp",         "statusString": "COMPLETE_SUCCESSFUL"     } }



www.threadfix.it | www.coalfire.com
Copyright © 2024 Coalfire. All rights reserved.

This Information Security Policy is CoalFire - Public: Distribution of this material is not limited.