Observe task test resource samples¶
Read file, schema, and row samples in the current task’s test resources. See Common information for objects, variables, and environment boundaries.
POST https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-test-scratch/observe
Before you call this API¶
Retain injected service URLs, credentials, Workspace, and short-lived authorization in the current generation task environment. Use complete original authorization header values. Install jq and set the example variables.
Request body¶
curl -X POST "${MOI_ENDPOINT%/}/workflow/v2/workflow-test-scratch/observe" \
-H "X-API-Key: $MOI_API_KEY" \
-H "X-Workspace-ID: $MOI_WORKSPACE_ID" \
-H "X-MOI-Runtime-Authorization: $MOI_RUNTIME_AUTHORIZATION" \
-H 'Content-Type: application/json' \
--data-binary "$(jq -n '{}')"
This API first calls EnsureScratch and may create test databases/volumes before reading file/table samples. It is not a read-only health query. A volume returns up to 1000 files and a table up to 100 rows. Check total, row_count, and truncated rather than treating samples as complete sets. Regular identity scope conditions match preparation.
Fields |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Optional in task mode |
Derived from verified task identity; explicit values must match. |
|
string |
Optional in task mode |
Derived from verified task identity; explicit values must match. |
|
string |
Optional in task mode |
Derived from verified task identity; explicit values must match. |
|
integer |
No |
Catalog for resource creation. 0 resolves the default Catalog, which must resolve to a positive value. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"scope": "current_task",
"database_name": "scratch_example",
"volumes": [
{
"volume_id": 12,
"files": [],
"total": 0,
"truncated": false
},
{
"volume_id": 13,
"files": [],
"total": 0,
"truncated": false
}
],
"tables": []
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
OK on success. |
|
string |
Response information. |
|
object |
Result of this operation. |
|
string |
Observation scope; actual value returned by the server. |
|
string |
Test database. |
|
object[] |
File samples from input/output volumes. |
|
integer |
Volume ID. |
|
object[] |
Current file list; verify file objects against Catalog definitions separately. |
|
integer |
Total volume files. |
|
boolean |
Whether the current file list is shorter than the total. |
|
object[] |
Schema and row samples. |
|
string |
Table name. |
|
object[] |
Column names and data types. |
|
integer |
Total table rows. |
|
array[] |
Row values; retain JSON scalar types returned by the SQL driver. |
|
boolean |
Whether row samples are fewer than total rows. |
Error response¶
Handle HTTP status and business fields. History and recovery have dedicated errors; see Errors and environments. Retain identity, source references, and operation identifiers, then check state before proceeding. Do not automatically switch workspace, candidate, or confirmation key.