Export Asset Data
This step allows you to export data for an existing asset in Cyberwatch in CycloneDX or SPDX format.
Exports only work for assets that already exist in Cyberwatch.
API Endpoint
Method: GET
URL: https://Your URL/api/v3/servers/{id}/export
Path Parameters
Name | Type | Required | Description |
---|---|---|---|
id | string | yes | Identifier of the asset |
Query Parameters
Name | Type | Allowed Values | Description |
---|---|---|---|
format | enum | CycloneDX | SPDX | Desired export format |
Authentication: Basic (access key / secret key) Accept Header: application/json; charset=utf-8
1. Request Examples
a) cURL
curl -X GET "https://<Your URL>/api/v3/servers/123/export?format=CycloneDX" \
-u "access_key:secret_key" \
-H "Accept: application/json; charset=utf-8" \
--output export-asset-cyclonedx.json
b) PowerShell
# Pre-configuration
$API_URL = "https://<Your URL>"
$CREDENTIALS = "access_key:secret_key"
$encodedCreds = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($CREDENTIALS))
# Dynamic parameters
$assetId = Read-Host -Prompt "ID of the asset to export"
$format = Read-Host -Prompt "Export format (CycloneDX or SPDX)"
# API call
$response = Invoke-RestMethod -Uri "$API_URL/api/v3/servers/$assetId/export?format=$format" `
-Method GET `
-Headers @{
"Accept" = "application/json; charset=utf-8"
"Authorization" = "Basic $encodedCreds"
}
# Save output
$outputFile = "export-asset-$assetId.$($format.ToLower()).json"
$response | Out-File -FilePath $outputFile -Encoding utf8
Write-Output "Export saved to $outputFile"
2. Response
Code | Description |
---|---|
200 | Returns the CycloneDX or SPDX content for the asset |
The returned file is JSON (CycloneDX) or plain text (SPDX). If the specified
assetId
does not exist, the API returns 404. If theformat
parameter is invalid, it returns 400.