Skip to content

Get Data Query Task Results



GET /api/v1/log_backup_query/get_result

Overview

Retrieve the status of an asynchronous query task and its masked results.

Before Calling and Usage Steps

Use the task_id returned by query_task as Query.taskId for polling. The status and result fields are returned by the downstream service. Only task_status=completed is treated as completed; for other statuses, continue waiting or handle the failure based on the response information. Do not rely on HTTP 200 to determine completion. On completion, Studio performs masking according to the rule's dataType, syncExtensionField, and the current identity, then records a completed query audit (deduplicated by task).

message may be text or a JSON string. Parse it according to the data category and actual result; do not assume a fixed object structure. is_truncated/token are used for subsequent batch queries. Keep the original query conditions and pass token to query_task. The query context cache is retained for 12 hours. If the context is lost when the task completes, 410 is returned, and you need to create the query again; this duration is not a retention commitment of the downstream task itself. This result route does not re-check the rule readPermissionSet, but still goes through authentication and data masking for the current endpoint, and does not share task IDs with unauthorized identities.

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 this operation permission from API Key Management in the target workspace.

Query Request Parameters

Parameter Name Type Required Description
taskId string Y Required original task ID. If it contains characters such as colons, use URL encoding. Do not mix it with token.
Null allowed: False
Example: task_example
How to obtain or enter: Obtain it from content.task_id in the query_task response.

Supplementary Parameter Description

Field descriptions in the response result.

Parameter Name type Description
token string Query cursor. To perform paginated queries, include the token from the request result.
row string Retrieved row information.
task_status string Task status (created, running, completed, failed).
total_files integer Total number of files.

Note: When the task status is created or running, retrieval is still in progress. completed and failed indicate that retrieval has ended.

Request Example

curl --get 'https://openapi.truewatch.com/api/v1/log_backup_query/get_result' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  --data-urlencode taskId=task_example

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content.task_status string Downstream task status. completed means completed; other values are returned as-is.
content.row array<object> Query rows after completion. Can be empty and may be omitted when not yet completed.
content.row[].message string or JSON Masked data payload, often raw text or serialized JSON; not necessarily an object.
content.row[].date integer Upstream record time. Existing protocol examples use Unix milliseconds; this is not the Unix seconds of the rule createAt.
content.row[].Other columns JSON Depending on the data type, additional upstream record columns may be included.
content.token string Transparent cursor used to keep the conditions and create the next round of tasks; may be empty or omitted.
content.is_truncated boolean Whether the current result is truncated. Use it together with token to schedule the next batch; may be omitted.
content.total_files integer Retrieval file statistics returned by the upstream; may be omitted.
content.search_completed number Upstream retrieval completion statistics value. Studio does not normalize it; do not treat it as a completion boolean or percentage. Use task_status to determine completion.
content.declaration object Public declaration for a non-empty object.
{
  "code": 200,
  "content": {
    "token": "CURSOR-EXAMPLE",
    "row": [
      {
        "message": "{\"message\":\"error: example\",\"service\":\"checkout-api\"}",
        "date": 1785427200000
      }
    ],
    "is_truncated": true,
    "total_files": 2,
    "search_completed": 0,
    "task_status": "completed",
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

The following downstream query business errors are retained by the SDK with the actual upstream 4xx status. Do not determine them only by the local default 406. An unrecognized downstream error_code is mapped to ft.BackuplogInternalServerError when the upstream returns 4xx, and the actual HTTP status is retained. Record the original error and traceId for troubleshooting. Ordinary upstream 5xx errors, timeouts, and similar failures are ultimately unified as 500 ft.InternalServerError.

errorCode Trigger and Handling
ft.BackuplogInvalidAPIArgs Downstream query parameters such as time, filters, or cursor do not match. Correct the parameters according to the downstream message, and keep the same conditions when continuing the query.
ft.BackuplogBucketNotFound The target object storage does not exist. Check the rule target and bucket lifecycle.
ft.BackuplogRuleNameInvalid The downstream rule name is invalid or the configuration has not been synchronized. Check the current rule and backend status, then retry.
ft.BackuplogOSAccessDenied The downstream service is not authorized to read the target data. Check the target authorization, roles, and resource access policies.
HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed An undeclared Query parameter is used, or a parameter violates the rules Parameter parsing failed Check the Query parameter table and example.
410 ft.BackuplogQueryContextExpired The completed result requires masking, but the query context has been lost or is older than 12 hours The data forwarding query context has expired. Please recreate the query task. Recreate the task with the original conditions and then retrieve the result. Masking cannot be bypassed.
500 ft.InternalServerError Ordinary downstream 5xx, result masking, cache, or completion audit processing fails Internal error Retain taskId/traceId, check the current query state, and retry. If the failure persists, contact the administrator.