Query Workspace Resource Task Progress¶
GET /api/v1/workspace/resource/query_action_status
Overview¶
Query the progress of resource import/export tasks that you created in the current workspace.
Prerequisites and Usage Steps¶
- Obtain the task ID from
content.taskIdin Export Task or Import Resource Package. - Use the same workspace and the same Key resource identity as when the task was created, put
taskIdin the query, and poll periodically. - Determine the result based on
status,error_code, andimport_info; readurlonly after the export completes. For imports, also verify item-level failures and skips; do not rely solely on HTTP 200.
You only need the routine.defaultAccess permission allowed for this endpoint, and use the Key and workspace that created the original task. Poll with taskId. When no cache exists at all, the API normally returns HTTP 200 with content.status=null rather than 404; after a long task expires, a status write may rebuild an incomplete cache lacking ownership and return 403. Do not interpret such a 403 only as using the wrong Key. Accessing an existing task of another user or in another workspace without permission returns 403; an incomplete cache for a long task may also trigger 403. Keep the taskId and contact the administrator to verify.
status=start/running means continue waiting; ok/error/cancel are stage statuses, but you must also check error_code and import_info. An export status of ok may indicate partial success; check exportInfo.result and failure details, then download the url promptly. An import status of ok may also contain failures, conversions, skips, or noJsonDataError; verify each item. Do not blindly rerun recover; first confirm which resources have been successfully saved.
Some asynchronous errors are converted to non-2xx responses at query time: fileContentError becomes a JSON format error; registered ft.* errors are returned according to their business status (ordinary 5xx errors are wrapped as 500). When imported failedItems contain a matching error_code, this route forces HTTP 400 and preserves the business errorCode/message; the error content also includes status/action/error_code/import_info, which may also contain success counts. Neither errors nor cancellation guarantee a full rollback. The task cache TTL defaults to 600 seconds in code, but actual sites may override it; the cache TTL is set only at creation and is not renewed by subsequent status updates. For expired/incomplete caches, verify resources based on task logs and known results before deciding whether to recreate.
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or enter: Obtain an OpenAPI Key with the required operation permission from API Key Management in the target workspace. |
Query Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| taskId | string | Y | Required, non-empty task ID; must use the same workspace and same Key resource identity that created the task, not the file name. Null allowed: False Example: resource_task_exampleHow to obtain or enter: Obtain it from content.taskId in the response of Export Resource Task or Import Resource Package. |
Additional Parameter Notes¶
The task result is determined by the status, error_code, and import_info fields on this page. The short-lived ZIP download address does not need to be converted to another Studio API address; keep the full URL as a sensitive backup address. Partial success does not trigger a full rollback; read back and verify resources that have completed.
Request Example¶
curl --get 'https://openapi.truewatch.com/api/v1/workspace/resource/query_action_status' \
-H 'DF-API-KEY: <DF-API-KEY>' \
--data-urlencode taskId=resource_task_example
Response¶
HTTP 200, application/json. The examples below show the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content.status | string or null | start: queued, running: executing, ok: finished, error: abnormal, cancel: cancellation requested; null when no cache exists at all, and an incomplete status record after expiration may return 403. For ok, you still need to check errors and the partial success summary. |
| content.action | string | export or import; returned when a cache exists. |
| content.error_code | string or null | Asynchronous business error code; may be ft.* or fileContentError/noJsonDataError. Some registered errors are converted to non-2xx responses for this request; see Error Responses. |
| content.import_info | object | A legacy field name; used for both export and import to carry the task summary. |
| content.url | string | Returned only for export and status=ok; a downloadable URL does not mean all resources have been exported, and it is not a permanent backup address. |
| content.noJsonDataImported | string | Localized description when error_code=noJsonDataError; a localized hint. It may also appear when cancellation/interruption prevents the outer layer from obtaining the actual completed count; it does not prove that no writes occurred, so verify resources. |
| content.declaration | object or null | Workspace common declaration attached to non-empty content; may be null or an empty object when not configured. |
| content.import_info.successCount | integer | Number of successfully imported resources counted by the importer; may be omitted and does not prove that all downstream synchronization succeeded. |
| content.import_info.failCount | integer | Number of failed entries counted; for partial failures, the counting scope depends on the resource type; may be omitted. |
| content.import_info.skippedCount | integer | Number of explicit skips; may be omitted. |
| content.import_info.failedItems | array<object> |
Business failure details, such as Log Index migration; may be omitted. |
| content.import_info.failedItems[].resourceType | string | Resource type. |
| content.import_info.failedItems[].fileName | string | Source configuration file name. |
| content.import_info.failedItems[].name | string | Resource name. |
| content.import_info.failedItems[].errorCode | string | Business code after security normalization; may not match the default registered status for this HTTP response. |
| content.import_info.failedItems[].message | string | Sanitized business error message. |
| content.import_info.convertedItems | array<object> |
Storage/schema migration conversion records; may be omitted. |
| content.import_info.convertedItems[] | object | Resource migration conversion summary; varies by type. |
| content.import_info.skippedItems | array<object> |
Skip records such as unsupported modes; may be omitted. |
| content.import_info.skippedItems[].resourceType | string | Resource type. |
| content.import_info.skippedItems[].fileName | string | Source file name. |
| content.import_info.skippedItems[].name | string | Skipped resource name. |
| content.import_info.skippedItems[].reason | string | Skip reason, such as unsupportedIndexMode. |
| content.import_info.skippedItems[].errorCode | string | Corresponding business code; may be omitted. |
| content.import_info.skippedItems[].message | string | Business explanation for skipping; may be omitted. |
| content.import_info.authFailedCrossWsInfo | array<object> |
Cross-workspace resource authorization failure information; may be omitted, and the task may partially succeed. |
| content.import_info.authFailedCrossWsInfo[] | object | Details of the associated object that failed. |
| content.import_info.skippedTags | array<object> |
Summary of tags skipped during import due to tag scope and other reasons; may be omitted. |
| content.import_info.skippedTags[] | object | Details of skipped tags, following the tag import summary structure. |
| content.import_info.exportFailedInfo | object | Export module error mapping; partial success is possible; the value is an array of error strings for that resource type. |
| content.import_info.exportFailedInfo.资源类型 | array<string> |
List of export errors for a resource type. |
| content.import_info.exportFailedInfo.资源类型[] | string | Module error message. |
| content.import_info.exportInfo | object | Export completeness summary; may be omitted. |
| content.import_info.exportInfo.result | string | complete/partial; SLO shared queries may also return empty. Do not infer complete from ok. |
| content.import_info.exportInfo.requestedSloCount | integer | Number of SLO-specific requests; the workspace-wide entry is usually 0. |
| content.import_info.exportInfo.exportedSloCount | integer | Actual number of SLO-specific exports; usually 0 for the whole workspace. |
| content.import_info.exportInfo.skippedSloCount | integer | Number of SLO-specific skips. |
| content.import_info.exportInfo.candidateResourceCount | integer | Number of candidate resources counted. |
| content.import_info.exportInfo.exportedResourceCount | integer | Number of exported resources counted. |
| content.import_info.exportInfo.permissionDeniedResourceCount | integer | Number of resources denied by permission. |
| content.import_info.exportInfo.permissionDeniedByType | object | Number of denials counted by resource type. |
| content.import_info.exportInfo.permissionDeniedByType.资源类型 | integer | Number of denials for that type. |
| content.import_info.exportInfo.affectedSloCount | integer | Number of SLOs affected by dependency failures. |
| content.import_info.exportInfo.otherSkippedResourceCount | integer | Number of other skips. |
| content.import_info.exportInfo.resourceFailureInfo | object | Complete resource failure reason grouping. |
| content.import_info.exportInfo.resourceFailureInfo.schemaVersion | integer | Currently 1. |
| content.import_info.exportInfo.resourceFailureInfo.totalCount | integer | Number of failure details. |
| content.import_info.exportInfo.resourceFailureInfo.permissionDeniedCount | integer | Number of permission-related failures. |
| content.import_info.exportInfo.resourceFailureInfo.otherCount | integer | Number of other failures. |
| content.import_info.exportInfo.resourceFailureInfo.byReason | object | Reason code → count. |
| content.import_info.exportInfo.resourceFailureInfo.byReason.原因码 | integer | Number for that reason. |
| content.import_info.exportInfo.resourceFailureInfo.items | array<object> |
Per-resource failure details. |
| content.import_info.exportInfo.resourceFailureInfo.items[].resourceType | string | Resource type. |
| content.import_info.exportInfo.resourceFailureInfo.items[].resourceUUID | string or null | Source resource UUID; may be null. |
| content.import_info.exportInfo.resourceFailureInfo.items[].resourceName | string or null | Display name; may be null. |
| content.import_info.exportInfo.resourceFailureInfo.items[].reasonCategory | string | permission or other. |
| content.import_info.exportInfo.resourceFailureInfo.items[].reasonCode | string | Reason code such as permission_denied/serialize_failed. |
| content.import_info.exportInfo.resourceFailureInfo.items[].affectedSloList | array<object> |
Affected SLO list. |
| content.import_info.exportInfo.resourceFailureInfo.items[].affectedSloList[].sloUUID | string | SLO UUID. |
| content.import_info.exportInfo.resourceFailureInfo.items[].affectedSloList[].sloName | string or null | SLO name; may be null. |
| content.import_info.convertedItems[].resourceType | string | Converted resource type. |
| content.import_info.convertedItems[].fileName | string | Source configuration file for conversion. |
| content.import_info.convertedItems[].name | string | Converted index name. |
| content.import_info.convertedItems[].field | string | Converted field; currently isFullLineIndex. |
| content.import_info.convertedItems[].from | JSON | Original mode value; example 0. |
| content.import_info.convertedItems[].to | JSON | New mode value; example 1. |
| content.import_info.skippedItems[].indexName | string | Source/cloned index name for the specific unsupported mode. |
| content.import_info.skippedTags[].name | string | Skipped tag name. |
| content.import_info.skippedTags[].scope | array | Actual tag scope array. |
| content.import_info.skippedTags[].scope[] | string | Individual scope: all/scene/monitor/dialing/security/infrastructure/catalog. |
| content.import_info.authFailedCrossWsInfo[].name | string | Name of the queried/referenced source workspace. |
| content.import_info.authFailedCrossWsInfo[].uuid | string | Source workspace UUID. |
| content.import_info.authFailedCrossWsInfo[].checkerName | string | Name of the monitor involved in the cross-workspace query. |
| content.import_info.skippedTags[].expectedScope | string | Tag scope required by this resource. |
| content.import_info.skippedTags[].reason | string | Skip reason scope_mismatch. |
| content.import_info.skippedTags[].resourceUUID | string | Associated resource UUID; may be omitted. |
{
"code": 200,
"content": {
"status": "ok",
"action": "import",
"error_code": null,
"import_info": {
"successCount": 3,
"failCount": 0
},
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
{
"code": 200,
"content": {
"status": null,
"declaration": {}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Responses¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
Task errors are returned dynamically: for the failedItems matching branch with HTTP 400, errorCode equals error_code (including ft.InternalServerError, which may also be returned as 400); other registered ft.* errors use their corresponding business status, and ordinary errors >=500 are uniformly returned as ft.InternalServerError. Judge by the actual HTTP status, errorCode, and error content.import_info; do not treat all task errors as a single fixed status.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Using an undeclared Query parameter or a parameter that violates the rules | Parameter parsing failed | Check the Query parameter table and examples. |
| 406 | ft.ParameterValidationFailed | taskId is empty | Parameter parsing failed | Enter a valid original taskId. |
| 403 | ft.Forbidden | The task exists, but wksp_uuid or creator does not match the current call, including an ownership-lacking cache rebuilt for a long task | You do not have permission to perform this operation | Use the original workspace and original Key resource identity; if the identity is correct but 403 still occurs, keep the taskId and ask the administrator to verify expiration/task logs. Do not access it with another management Key. |
| 400 | ft.JsonFormatError | The asynchronous task records fileContentError | Some JSON files in the resource package have format errors | Fix the corresponding JSON in the resource package, verify imported resources, and upload again. |
| 500 | ft.InternalServerError | Task cache/queue, file system, database, or unhandled task status/JSON processing failure | Internal error | First query the task and current resource state with the same workspace and same Key; after confirming whether it has been queued or partially saved, retry. Do not blindly repeat the import or overwrite. |