Prepare task test resources¶
Prepare or reuse temporary databases and input/output volumes for the current task. See Common information for objects, variables, and environment boundaries.
POST https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-test-scratch/ensure
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/ensure" \
-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 '{}')"
The example derives scope from authorization in the task environment. A regular Product identity path also exists but requires explicit task_id, context_id, effective_role_id, and other scope conditions. A PAT does not replace task scope. Existing resources must match user, role, and conversation bindings. Preparation may create a database and input/output volumes; it does not publish a workflow.
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": {
"workspace_id": "workspace-1",
"task_id": "task-1",
"user_id": "user-1",
"effective_role_id": "role-1",
"context_id": "context-1",
"operation_id": "operation-example",
"catalog_id": 1,
"database_name": "scratch_example",
"database_id": 11,
"input_volume_id": 12,
"output_volume_id": 13,
"state": "active"
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
OK on success. |
|
string |
Response information. |
|
object |
Result of this operation. |
|
string |
Resource workspace. |
|
string |
Owning task. |
|
string |
Owning user. |
|
string |
Effective role. |
|
string |
Owning conversation. |
|
string |
Resource operation identifier. |
|
integer |
Catalog ID。 |
|
string |
Test database name. |
|
integer |
Test database ID. |
|
integer |
Input volume ID. |
|
integer |
Output volume ID. |
|
string |
Lease state; active in the example. |
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.