Creating new tasks
Within your Workstation App you can create tasks and review their output to check if the answers are correct.
Creating tasks via API
Creating a new task is similar to making a call to your Canvas, except that instead of passing your canvas_id
, you’re going to pass your application_id
.
Head to your Workstation App page and follow these steps:
Open Connect via API
At the top bar, click on the three dots on the right of your app’s title and select “Connect via API”.
Get your app data
Here you will find all the necessary info to start creating tasks with our API. Choose your preferred language and use one of the snippets provided to get started!
By default, all tasks are created as if they were async completions. You’ll receive a success
response and the task will have a running
status. You have two options for consuming the result of the task:
- Polling during execution
- Passing a webhook URL
Polling tasks during execution
You can do a simple polling until the status of the task changes to either completed
or failed
. To poll the status of a task after creating it we can make a request to our API /task
endpoint.
Passing a webhook URL
You can pass a webhook_url
to your API call. This way you’ll receive a POST
request in your endpoint when the task finishes.
Fetching tasks
To retrieve tasks from an app, you can send a GET
request to the /task
endpoint. This endpoint supports various optional parameters for filtering and pagination:
Pagination parameters
limit
: Number of results per response (default: 10, range: 1-100)offset
: Starting position of results (default: 0)
Filtering parameters
status
: Array of task statuses (options: “created”, “running”, “validating”, “completed”, “failed”)since
: Start date for filtering tasks (format: timestamp or ISO 8601)until
: End date for filtering tasks (format: timestamp or ISO 8601)approvedBy
: Email of the user who approved the taskrevisionProcess
: Type of revision received (options: “approvedWithRevisions”, “approvedDirectly”)promptApplicationId
: ID of the application where the task was createdpromptVersionId
: ID of the Canvas version used to create the taskids
: Array of specific task IDs to retrieve
Sorting parameters
orderBy
: Field to sort by (options: “name”, “reference”, “approvedAt”, “createdAt”, “updatedAt”, “id”, “status”, “approvedBy”, “createdBy”)order
: Sort direction (options: “asc” or “desc”)
Example request
Here’s an example of fetching 50 completed tasks created after November 1st, 2024, sorted by name in ascending order: