Skip to content

Workspace Resource Task Status Query



GET /api/v1/workspace/resource/query_action_status

Overview

Query the status of workspace resource import and export tasks.

Query Request Parameters

Parameter Type Required Description
taskId string Y Task ID
Example: task_xxx
Allow empty: False

Additional Parameter Notes

1. API Purpose

Query the execution status of workspace resource import or export tasks.

When a Log Index import fails, HTTP 400 and the original business error code/reason are returned. content.import_info.failedItems contains resourceType, fileName, name, errorCode, and message. The same import_info retains successCount and failCount, and returns successfully converted newly created indexes in convertedItems (file, index name, fields, and from/to) as needed. Unsupported index modes are skipped entirely. skippedItems returns the resource type, file, resource name name, specific index name indexName, reason=unsupportedIndexMode, error code, and reason. skippedCount is the total number of skipped items due to duplicate names and unsupported modes. Skipped items are not counted as success or failure. When there are only skipped items, status=ok is returned normally. Legacy task cache keeps its original behavior; partial failure does not mean that already successful resources are rolled back.

The response structure is consistent with the frontend interface and applies to: - Export task result queries - Import task result queries - Error code and failure information queries


2. Common Status Values

Status Value Description
start The task has been created but has not started execution yet
running The task is executing
ok The task executed successfully
error The task failed
cancel The task has been canceled

3. Common Response Field Descriptions

Field Description
status Current task status
action Task type, commonly import or export
message Additional notes
error_code Error code on failure
import_info Import/export statistics and failure information
name_list Resource name list attached to certain tasks
url Short-term static ZIP download URL returned after a successful export

4. Export Task Query Notes

After an export task succeeds, the status is ok and the full short-term static ZIP download URL is returned in url. The caller can directly use this URL to stream-download resource.zip without converting it to any other Studio API address.

The status query validates the task creator and workspace corresponding to taskId; the static file download request itself no longer performs DF-API-KEY authentication. Do not record, forward, or retain the full download URL long-term, and complete the download as soon as possible within the task validity period.

After an SLO resource package or workspace resource export is complete, you can view import_info.exportInfo. If some objects fail during the export, prioritize resource-level details:

{
  "result": "partial",
  "permissionDeniedResourceCount": 1,
  "otherSkippedResourceCount": 1,
  "resourceFailureInfo": {
    "schemaVersion": 1,
    "totalCount": 2,
    "permissionDeniedCount": 1,
    "otherCount": 1,
    "byReason": {
      "permission_denied": 1,
      "serialize_failed": 1
    },
    "items": [
      {
        "resourceType": "checker",
        "resourceUUID": "rul_xxx",
        "resourceName": "支付可用性检查器",
        "reasonCategory": "permission",
        "reasonCode": "permission_denied",
        "affectedSloList": [
          {
            "sloUUID": "monitor_xxx",
            "sloName": "支付可用性 SLO"
          }
        ]
      }
    ]
  }
}

Failure reason codes include permission_denied, dependency_not_found, resource_not_found, serialize_failed, unsupported_resource, and unknown.

Legacy clients can still view:

import_info.exportFailedInfo

5. Import Task Query Notes

After an import task succeeds, the following can typically be seen in import_info:

  • successCount
  • failCount

Detailed failure reasons for certain resources are reflected in error_code or in the internal error statistics of the import task.


6. Polling Recommendation

It is recommended to poll every 2 to 5 seconds until the status becomes: - ok - error - cancel


Request Example

curl 'https://openapi.truewatch.com/api/v1/workspace/resource/query_action_status?taskId=task_xxx' \
-H 'DF-API-KEY: <DF-API-KEY>' \
--compressed

Response

{
    "code": 200,
    "content": {
        "status": "ok",
        "action": "export",
        "error_code": "",
        "import_info": {},
        "url": "https://static.example.com/temporary/random_task/resource.zip"
    },
    "errorCode": "",
    "message": "",
    "success": true,
    "traceId": "TRACE-XXXX"
}