Use activities to check if the progress of operations like upload, transcodings or batchUpdates. Activities also include information on changes of documents in ElasticSearch.
General Structure
The activities response contains 3 properties: activities, modelChanges and modelChangesES. For performance reasons we recommend that you only fetch data you really need.
ModelChangesES
Every time a document (a mediacontainer) is updated in ElasticSearch, it will be logged and available in modelChangesES. There is one entry per mediaContainerId which contains all information regarding latest updates. Changes are available for 60 seconds. Every entry also contains an object “affectedModels” which gives you an information on which models have changed. Every of those entries contains and updated properties with the timestamp of the ElasticSearch update and well as a timeRange array which contains the timestamp of the first and last payload for this update.
The backend combines updates to ElasticSearch, therefore different changes (e.g. multiple metadata changes) could be send in one batch to ElasticSearch. The timeRange array contains information on the first and last timestamp used for this update.
How to use modelChangesES
Let’s assume you send 3 metadata updates to the API, every API call with 50ms difference (0,50,100). Let’s further assume those updates are send as one batch (please note that there is no guarantee how updates are combined!). Now the modelChangeES update will look like this:
{
model: 'es:mediacontainer',
id: 123,
affectedModels: {
mediaContainer: {
timeRange: [0,100]
updated: 200
}
},
updated: 200
The updated property in affectedModels contains the timestamp the data has been sent to ElasticSearch. The root level property is the latest timestamp of updates sent to ElasticSearch, i.e. if there are multiple affectedModels the most current updated timestamp from all models will be set as updated timestamp on root level.
Reference
Find activities
Find all activities available for this user (depending on his membership to security groups). This call is also used to set a heartbeat so the API knows that the user is still active.
Field | Type | Required | Description |
---|---|---|---|
jobId | string | ✗ | If you send a jobId, only this job will be affected/found |
properties | base64 | ✗ | Limit the response object to the given properties. |
Field | Type | Description |
---|---|---|
activities | array | Array of activity objects containing job information and progress |
└ processor | string | Name of the processor handling this activity (e.g., "BULL") |
└ jobId | string | Job UUID – unique identifier for this activity job |
└ state | string | Current state of the job inactiveactivecomplete |
└ type | string | Type of the activity (e.g., "processTranscodings", "transcodeHLS", "upload", etc.) |
└ title | string | Technical title of the job – not recommended for displaying to end users |
└ progress | float | Progress of this activity as a percentage (0-100) range: 0 to 100 |
└ statusText | string | Status text providing additional information about the current state of the job |
└ description | string | Description of the current job action (e.g. uploadingThumbnailVariations, transcodeFinished, etc.) |
└ originalMediaId | integer | Original media ID this activity is based on (i.e. the mediaSource ID for a transcoding) |
└ favorites | boolean | True if this is a MediaContainer batch update handling favorites |
└ ids | array | MediaContainer IDs processed with this job – can be used to display "pending update" in MediaContainer summary |
└ age | integer | Age of the job in seconds since it was created |
└ timeToGo | integer | Estimated time remaining for job completion in seconds |
└ creatorId | integer | User ID of the creator who initiated this job |
└ updatedAt | datetime | ISO timestamp when this activity was last updated |
└ mediaContainerId | integer | ID of the MediaContainer this activity is linked to |
└ formatId | integer | ID of the format this activity is linked to (only applicable for transcodings) |
└ formatName | string | Name of the format being processed (e.g., "HLS 240", "WebM 360p") |
└ metadata | object | Additional metadata associated with this activity, typically contains container_name |
└ mediaId | integer | ID of the media file associated with this activity |
jobId | string | Job UUID – unique identifier for this activity job |
modelChanges | array | Array of model changes that occurred during processing |
└ model | string | Name of the affected model |
└ id | integer | ID of the affected model instance |
└ updated | integer | Timestamp when the model was last updated |
modelChangesES | array | Array of Elasticsearch model changes that occurred during processing |
└ model | string | Name of the affected model in Elasticsearch |
└ id | integer | ID of the affected model instance |
└ customerId | integer | Customer ID associated with the change |
└ affectedModels | object | Object containing information about affected models and their update timestamps |
└ updated | integer | Timestamp when the model was last updated |
└ debug | boolean | Debug flag indicating if debug information is available |
└ affectedFields | object | Object containing information about which fields were affected in each model |
percent | float | Progress of this activity (0-100) range: 0 to 100 |
statusText | string | Status text for the activity. Can be "waiting", "time to go", "finished", etc. |
Type | Subtype | Notes |
---|---|---|
miscActivities | There are a number of misc activities (s. Subtypes) | |
Contact creation | ||
Contact metadata changes | ||
Format changes | ||
License model changes | ||
Message changes | ||
Player configuration changes | ||
Security group changes | ||
Social media changes | ||
Tag favorite changes | ||
Template changes | ||
ES Mediahub updates | ||
Security group changes | ||
Security group changes | ||
mergeRAWimage | ||
metadataProcessing | Metadata updates from Transcoder | |
processingSocialMedia | ||
tagProcessing | Processing tag changes | |
tagUpdates | Updating tags in ES | |
updatingCustomerConfiguration | ||
importingSubtitleFile | Import subtitles | |
importTags | Import tags from XLS to AC | |
mediaContainerDeleted | ||
upload | Upload to AdmiralCloud |
Create activity
Create an activity that will show in Activity.find response. Make sure to send an activity update at least every 30 seconds. If the API server does not receive activity updates for more than 90 seconds, it will delete the activity. Activities do not execute functions, they only show progress.
Field | Type | Required | Description |
---|---|---|---|
mediaContainerId | integer | ✓ | MediaContainer ID to create activity for |
origin | string | ✗ | Optional identifier for origin – will be available in activity.find |
type | string | ✓ | Type of activity to create uploadurluploadmiscActivities |
Field | Type | Description |
---|---|---|
jobId | string | Job UUID – unique identifier for this activity job |
jobList | string | Name of the job list the job was created in |
Update activity
Updates an activity. If the activity/job does not exist or is already completed, the update is ignored.
Field | Type | Required | Description |
---|---|---|---|
jobId | string | ✓ | Job ID of the updated job |
percent | float | ✗ | Percent value of the current progress (between 0 and 100), when sending 100 the job will be changed to "finished" range: 0 to 100 |
statusText | string | ✗ | Optional status text for the progress (will be available as description in activity.find) |
Field | Type | Description |
---|---|---|
expireTime | integer | Unix timestamp when the job will expire and be removed from the database |
jobId | string | Job UUID – unique identifier for this activity job |
percent | float | Progress of this activity (0-100) range: 0 to 100 |
statusText | string | Status text for the activity. Can be "waiting", "time to go", "finished", etc. |
Destroy activity
Destroys an activity, for example when an upload is cancelled by the user.
Field | Type | Required | Description |
---|---|---|---|
jobId | string | ✓ | Job ID of the job to be deleted |
Field | Type | Description |
---|---|---|
jobId | string | Job UUID – unique identifier for this activity job |
Get jobResult for activity
Returns the result of a (batch) job. Can only be fetched after activity’s progress for this job is 100% (job is completed). If there is no job result, a JSON with property “ok” as true is returned.
Field | Type | Required | Description |
---|---|---|---|
jobId | string | ✓ | Job ID to fetch result for |
Field | Type | Description |
---|---|---|
conflict | array | Array of items with conflicts |
└ id | integer | ID of the mediaContainer that was affected |
└ message | string | Message about the conflict reason |
└ additionalInfo | object | Additional information about the conflicted item |
error | array | Array of IDs that had errors |
└ id | integer | ID of the item that had an error |
└ message | string | Error message related to the failed item |
└ additionalInfo | object | Additional information about the error |
ignored | array | Array of ignored items (e.g. no access) |
└ id | integer | ID of the mediaContainer that was ignored |
└ message | string | Message about the ignored item |
└ additionalInfo | object | Additional information about the ignored item |
processed | array | Array of IDs that were successfully processed |
└ id | integer | ID of the successfully processed item |
└ message | string | Optional message related to the processed item |
removed | array | Array of removed items Please do not use this field |
└ id | integer | ID of the mediaContainer that was removed |
└ message | string | Message about the removed item |
└ additionalInfo | object | Additional information about the removed item |