# Task User API {% hint style="warning" %} Workflow engine is configured by zen. We do not support it and do not recommend to use it anymore. Please, use any other workflow engine e.g. [Temporal](https://temporal.io/). Since the 2405 release, using Aidbox in FHIR schema validation engine is recommended, which is incompatible with zen or Entity/Attribute options. [Setup Aidbox with FHIR Schema validation engine](broken-reference) {% endhint %} Task User API allows users to manually control Aidbox tasks by [RPC methods](../../../../../api/other/rpc-api.md). ### `awf.task/create-and-execute` Creates an instance of a defined task and makes it ready to be executed immediately or at a specified time. #### Params:
ParameterTypeRequiredDescription
idstringfalseIdentifier of task (If not provided, will be auto-generated).
labelstringfalseHuman- or machine-readable description of task instance.
Example: Import Patient resources
definitionstringtrueDefinition of predefined task or
custom-defined task.
Example: aidbox.archive/create-archive
paramsobjecttrueThe input parameters described in the task definition.
executeAtstringfalseTime at which the task will become ready. If not provided - task will become ready immediately.
Example: 2023-05-03T13:30:43
#### Result:
ParameterTypeDescription
resourceobjectCreated AidboxTask resource.
{% tabs %} {% tab title="Request" %} ```yaml POST /rpc content-type: text/yaml accept: text/yaml method: awf.task/create-and-execute params: definition: aidbox.bulk/import-resource-task params: type: aidbox input: url: https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz resourceType: Organization ``` {% endtab %} {% tab title="Response" %} ```yaml result: resource: params: type: aidbox input: url: >- https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz resourceType: Organization status: ready definition: aidbox.bulk/import-resource-task id: >- 61053bc2-aac6-49a1-91e7-7f9fa29afe21 resourceType: AidboxTask meta: lastUpdated: '2023-05-03T15:21:19.357771Z' createdAt: '2023-05-03T15:21:19.357771Z' versionId: '17525' ``` {% endtab %} {% endtabs %} ### `awf.task/status` Returns the status of a task instance with the specified id. #### Params:
ParameterTypeRequiredDescription
idstringtrueId of the task whose status will be returned.
include-settings?booleanfalseIf true , includes setting parameters predefined in definition.
Default: false
include-log?booleanfalseIf true, includes log of task status transitions according to #task-instance-lifecycle.
Default: false
#### Result:
ParameterTypeDescription
resourceobjectCreated AidboxTask resource.
settingsobjectTODO
logobject[]AidboxTaskLog resources for task with specified id
{% tabs %} {% tab title="Request" %} ```yaml POST /rpc content-type: text/yaml accept: text/yaml method: awf.task/status params: id: c9555892-6221-42b4-9b34-1428a18e893c ``` {% endtab %} {% tab title="Response" %} ```yaml result: resource: definition: aidbox.bulk/import-resource-task meta: lastUpdated: '2023-04-24T09:30:51.562261Z' createdAt: '2023-04-24T09:30:50.888731Z' versionId: '128371' params: type: aidbox input: url: >- https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz resourceType: Organization contentEncoding: gzip retryCount: 1 outcome: succeeded resourceType: AidboxTask status: done result: imported-resources: 100 execId: ea82769d-e083-461c-8cb0-3427ed466f19 label: >- Organization https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz id: >- c9555892-6221-42b4-9b34-1428a18e893c ``` {% endtab %} {% endtabs %} ### `awf.task/cancel` Cancels execution of a created task instance. #### Params:
ParameterTypeRequiredDescription
idstringtrueId of the task that will be canceled.
#### Result:
ParameterTypeDescription
resourceobjectCreated AidboxTask resource.
{% tabs %} {% tab title="Request" %} ```yaml POST /rpc content-type: text/yaml accept: text/yaml method: awf.task/cancel params: id: 485b9cbd-0a78-4909-9908-0ae2e66a2b12 ``` {% endtab %} {% tab title="Response" %} ```yaml result: resource: params: type: aidbox input: url: >- https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz resourceType: Organization status: done outcome: canceled executeAt: '2023-05-04T15:30:43' definition: aidbox.bulk/import-resource-task id: >- 485b9cbd-0a78-4909-9908-0ae2e66a2b12 resourceType: AidboxTask meta: lastUpdated: '2023-05-04T12:25:38.800464Z' createdAt: '2023-05-04T12:25:24.355856Z' versionId: '17563' ``` {% endtab %} {% endtabs %} ### `awf.task/list` Returns the list of all tasks. #### Params:
ParameterTypeRequiredDescription
filterobjectfalse
filter.includeDefinitionsstring[]falseArray of task definitions to include.
filter.excludeDefinitionsstring[]falseArray of task definitions to exclude.
filter.statusstringfalseInclude task with specified status.
Possible values: created, waiting, ready, requested, in-progress, done
filter.outcomestringfalseInclude task with status done and specified outcome.
Possible values: succeeded, failed, canceled
filter.ilikestringfalseilike search by resource content
sortobjectfalseMay contain either createdAt or lastUpdated.
sort.createdAtstringfalseSorts result by createdAt DateTime.
Possible values: asc, desc
sort.lastUpdatedstringfalseSorts result by lastUpdated DateTime.
Possible values: asc, desc
#### Result:
ParameterTypeDescription
resourcesobject[]Created AidboxTask resources.
{% tabs %} {% tab title="Request" %} ```yaml POST /rpc content-type: text/yaml accept: text/yaml method: awf.task/list params: filter: ilike: import-resource-task ``` {% endtab %} {% tab title="Response" %} ```yaml result: resources: - definition: aidbox.bulk/import-resource-task meta: lastUpdated: '2023-04-24T09:30:51.562261Z' createdAt: '2023-04-24T09:30:50.888731Z' versionId: '128371' params: type: aidbox input: url: >- https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz resourceType: Organization contentEncoding: gzip retryCount: 1 outcome: succeeded resourceType: AidboxTask requester: id: >- 38239f30-2e67-45fb-8e67-992c5c1b350e resourceType: AidboxWorkflow status: done result: imported-resources: 100 execId: ea82769d-e083-461c-8cb0-3427ed466f19 label: >- Organization https://storage.googleapis.com/aidbox-public/synthea/100/Organization.ndjson.gz id: >- c9555892-6221-42b4-9b34-1428a18e893 ``` {% endtab %} {% endtabs %}