Tasks
Introduction
Tasks are the most direct way to create new objects from your existing Media.
Each task receives an input
(typically a file_id
) and creates an output
. The output
object must include a kind
and may also include a set of options
that are specific to the kind
of task.
You can see a list of tasks, create new tasks, and view the status of a task using the endpoints below.
Endpoints
List Tasks
Returns a list of recent tasks.
Endpoint
GET /tasks
Query Parameters
-
page integer
The page number to return. Default is 1.
-
limit integer
The number of items to return per page. Default is 12. Maximum is 100.
-
sort string
The field to sort by. Default is
created
. Possible values arecreated
,updated
,filesize
. -
order string
The order to sort by. Default is
desc
. Possible values areasc
,desc
. -
kind string
The kind of tasks to return. Possible values are
image
,video
,audio
, or any of thesource
,track
, orintelligence
task kinds. -
status string
The status of the tasks to return. Possible values are
ready
,processing
,waiting
,error
.
Create Task
Creates a new task, which will use the file passed in via the input
prop and create a new file based on the output
props.
The example given creates a new image from a video, with the filename poster.jpg
and a width of 640
pixels.
For a full list of available output kinds and options, see the Sources, Intelligence, and Tracks documentation.
Endpoint
POST /tasks
Body Parameters
-
input string
The ID of the media to use as the input for the task. You can use a
media_id
: theid
from a Media object, or afile_id
: theid
from a File object. -
output object
Defines the output for the task. The
output
object must include akind
and may include additional options that are specific to thekind
of task. The Sources, Intelligence, and Tracks documentation contain a full list of all available output kinds and their available options.
View Task
Returns the details for a single task.
Endpoint
GET /tasks/:id
Response Parameters
-
id string
Unique identifier for the task.
-
object string
Always
task
. -
input string
The ID of the Media or File that was used as the input for the task.
-
output integer
An object that details the created output. Will always include an
id
,object
, andkind
. Theobject
will depend on thekind
passed in to the task when it was created. If the task has completed successfully, theoutput
object will include the created Source, Intelligence, or Track object. -
status string
The status of the task. Possible values are
waiting
,processing
,ready
,error
. -
created datetime
The date and time the task was created. ISO 8601 format.
-
updated datetime
The date and time the task was last updated. ISO 8601 format.