Export (0) Print
Expand All

Task

Updated: February 18, 2014

A Task is an individual operation of work on an Asset and is defined in a Job.

This topic gives an overview of the Task entity and also demonstrates how to execute various operations with the Media Services REST API.

ImportantImportant
When working with the Media Services REST API, the following considerations apply:

Task Entity Properties

 

Property Type Description

Id

Read-only. Set by Media Services at creation time.

Edm.String

Unique identifier.

Configuration

Optional.

Edm.String

Preset that defines processing actions, such as encoding, protection, and so on, that the Task will perform. Maximum length is 100000.

EndTime

Read-only. Set by Media Services.

Edm.DateTime

The datetime when the task completed, failed, or was canceled.

ErrorDetails

Read-only. Set by Media Services.

Collection(ErrorDetail)

A collection of codes and detailed messages describing any errors that occur when a Task is running.

HistoricalEvents

Read-only. Set by Media Services.

Collection(TaskHistoricalEvent)

A collection of TaskHistoricalEvent objects that describe events associated with task execution.

MediaProcessorId

Required.

Edm.String

Id of the MediaProcessor that will be used in the Task. Valid values can be retrieved by performing GET request on /API/MediaProcessors.

Name

Optional.

Edm.String

Optional. Friendly name for the Task. Maximum length is 4000.

PerfMessage

Read-only. Set by Media Services.

Edm.String

Contains performance information about the Task.

Priority

Optional.

Edm.Int32

The priority of the task. A higher value indicates a higher priority relative to other tasks. . For example, a task with Priority = 40 will be processed before a task with Priority = 30. The upper bound is equal to MaxInt.

Progress

Read-only. Set by Media Services.

Edm.Double

Value indicating zero to 100 percent.

RunningDuration

Read-only. Set by Media Services.

Edm.Double

The elapsed time (in seconds) for the Task.

StartTime

Read-only. Set by Media Services.

Edm.DateTime

The datetime when the Task started.

State

Read-only. Set by Media Services.

Edm.Int32

The state of the Task. Valid values are:

  • None = 0

  • Active = 1

  • Running = 2

  • Completed = 3

TaskBody

Required.

Edm.String

XML document that contains information about which input and output assets the Task should run against. A Task must have at least 1 input asset and 1 output asset.

The XML document is of the following format.

<taskBody>
    <inputAsset> JobInputAsset(0)</inputAsset>
    <inputAsset> JobInputAsset(1)</inputAsset>
    <outputAsset assetCreationOptions=”1” 
                 assetName=”output” 
                 storageAccountName=”mystoreagename”>
                 JobOutputAsset(0)
    </outputAsset>
<taskBody>

The <outputAsset> element can have the following attributes:

  1. assetCreationOptions (or AssetCreationOptions). This attributes can have one of the following values: None=0x0, StorageEncrypted=0x1, CommonEncryptionProtected=0x2, EnvelopeEncryptionProtected=0x4. The default is StorageEncrypted.

  2. assetName (or AssetName). If none specified, Media Services sets a name in the following format: the parent outputAsset element suffixed by the Job Name (or the Job Id, if the Job Name is empty.

  3. storageAccountName (or StorageAccountName). The name of the storage account where the output asset will reside. If not specified, the user’s default storage account is used.

A task can depend on multiple tasks and also can have multiple dependents. For example, if Task A has an <outputAsset> that is referenced as an <inputAsset> by Task B, then Task B is dependent on Task A. As a result, Media Services has to finish processing Task A before it can process Task B.

Options

Required. Read-only after creation.

Edm.Int32

An enumeration value that describes the encryption options that a Task can be created with. Valid values are:

  • None = 0

  • ProtectedConfiguration = 1

EncryptionKeyId

Optional.

Edm.String

The encrypted Key Id.

EncryptionScheme

Optional.

Edm.String

The EncryptionScheme used with the configuration file. The valid value is "ConfigurationEncryption".

EncryptionVersion

Optional.

Edm.String

The version of configuration encryption to use. The currently supported version is "1.0".

InitializationVector

Optional.

Edm.String

The InitializationVector of the configuration file. Maximum length is 4000.

OutputMediaAssets

Read-only. Set by Media Services.

Asset entity set

Navigation property that can be accessed by referencing a specific task by Id value. The returned entity set contains all of the OutputMediaAsset entities that are linked to the specified task.

InputMediaAssets

Read-only. Set by Media Services.

Asset entity set

Navigation property that can be accessed by referencing a specific Task by Id value. The returned entity set contains all of the InputMediaAsset entities that are linked to the specified Task.

Create a Task

Tasks are created by creating a Job. For an example, see Create a Job.

List Tasks

Tasks are retrieved using a GET HTTP request.

 

Method Request URI HTTP Version

GET

https://media.windows.net/API/Tasks

HTTP/1.1

 

Method Request URI HTTP Version

GET

https://media.windows.net/API/Jobs('jobid')/Tasks

HTTP/1.1

Sample Request

ImportantImportant
After successfully connecting to https://media.windows.net, you will receive a 301 redirect specifying another Media Services URI. You must make subsequent calls to the new URI.

GET https://media.windows.net/API/Jobs('nb:jid:UUID:b1f956b3-774c-bb44-a3f7-ee47e23add31')/Tasks HTTP/1.1
Content-Type: application/json;odata=verbose
Accept: application/json;odata=verbose
DataServiceVersion: 3.0
MaxDataServiceVersion: 3.0
x-ms-version: 2.6
Authorization: Bearer http%3a%2f%2fschemas.xmlsoap.org%2fws%2f2005%2f05%2fidentity%2fclaims%2fnameidentifier=youraccountname&urn%3aSubscriptionId=2f84471d-b1ae-4e75-aa09-010f0fc0cf5b&http%3a%2f%2fschemas.microsoft.com%2faccesscontrolservice%2f2010%2f07%2fclaims%2fidentityprovider=https%3a%2f%2fwamsprodglobal001acs.accesscontrol.windows.net%2f&Audience=urn%3aWindowsAzureMediaServices&ExpiresOn=1337212980&Issuer=https%3a%2f%2fwamsprodglobal001acs.accesscontrol.windows.net%2f&HMACSHA256=kK7PbPM3lTAEJYIx5OTWeaSY7zvia358UjPiuvSFHz0%3d
Host: media.windows.net

See Also


Build Date:

2014-07-28

Community Additions

ADD
Show:
© 2014 Microsoft