REST API for uploading disconnected scan results
Available from 9.2.30. You use the POST operation on the /api/sam/v2/scan_results_upload element to upload results of the disconnected scans to the disconnected data source. The results are provided in the request body in the binary form.
Important: Uploading disconnected scan results by using REST API is supported for scan results generated by disconnected scanner in version 9.2.24 or later. If you use the disconnected scanner in older versions, either upgrade the scanner or upload scan results by using one of the following methods:
- Manually copy scan results to the disconnected data source.
- Use an automation technology of your choice.
- Mount shared folders to automatically transfer scan results.
Permissions
You must have the Manage Scan Uploads (previously: Manage Uploads) permission to use this API.
Resource URL
https://server_url:server_port/api/sam/v2/scan_results_upload
Resource information
| Operation details | Description |
|---|---|
| HTTP method | POST |
| Request headers |
|
| Request format | application/octet-stream |
| Request payload | Binary data (content of the scan results file) |
| Response headers |
|
| Response format | application/json |
| Response codes |
|
Request attributes
| Attribute | Description | Required |
|---|---|---|
| filename | Name of the file to be uploaded. | ✓ |
| datasource_name | Name of the disconnected data source to which the file will be uploaded. If you have one disconnected data source, you do not need to provide this parameter. However, if you provide the parameter, its value must match the actual data source. Otherwise, the upload fails.
Important: If you have multiple data sources, ensure that data from a single disconnected scanner is always uploaded to the same data source. Uploading data from a single disconnected scanner to multiple data sources is not supported and will fail during the import of data.
|
Example conversation
The example conversation uses cURL commands as they allow to easily upload a file in the binary format.- Request
-
Where:curl --insecure -v -H "Accept:application/json" -H "Token:<token>" -H "Content-Type:application/octet-stream" --data-binary "@<path_to_file><file_name>" -X POST "https://<host>:<port>/api/sam/v2/scan_results_upload? datasource_name=<data_source_name>&filename=<file_name>"- <token>
- Token of the user that will be used to upload disconnected scan results to the License Metric Tool server.
- <path_to_file>
- Path to the file with disconnected scan results.
- <host>
- IP or host name of the License Metric Tool server to which packages with disconnected scan results will be uploaded.
- <port>
- Port of the License Metric Tool server to which packages with disconnected scan results will be uploaded.
- <data_source_name>
- Name of the disconnected data source to which the file will be uploaded.
- <file_name>
- Name of the file to be uploaded.
- Response
-
200