Developers
How can we help you?
Workflow
If your company is using Mediagenix On-Demand’s Sequence product you can benefit from workflows. A workflow is part of a scheduling, and links a job resource from Sequence, with a scheduling in Mediagenix On-Demand.
In Mediagenix On-Demand land, a workflow looks like this:
<?xml version='1.0' encoding='utf-8' ?>
<workflow>
<status>completed</status>
<link rel="job" href="https://sequence.example.com/api/work_areas/37/jobs/48394"/>
</workflow>
{
"resource_type": "workflow",
"status": "completed",
"job_link": "https://sequence.example.com/api/work_areas/37/jobs/48394"
}
Workflows have a status
attribute that represents the progress. Possible values are:
completed
: all the tasks have been completed and all the materials (assets) have been received, i.e. the Sequence job status is eitherdone
,live
, orpassed
.pending
: all tasks are pending and all materials (assets) haven’t been received, i.e. the Sequence job status is eitherpending
orlate
.in_progress
: some tasks have been completed and/or some materials (assets) have been received, i.e. the Sequence job status is eitherpending
orlate
, the tasks status is notnot_received
and the assets status is notpending
.
Creating a new workflow
To create a new workflow for a scheduling you just need to POST
an empty XML/JSON workflow representation to the proper URL. As explained above, that URL is in the link node whose rel
attribute equals workflow in the scheduling.
For example, this POST
would create a workflow (we’ll use curl’s @ option, which reads the data that is to be posted to the URL from a file):
$ cat workflow.xml
$ cat workflow.json
<workflow></workflow>
{}
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @workflow.xml "https://movida.bebanjo.net/api/schedulings/46/workflow"
$ curl --digest -u robot_user:password -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d @workflow.json "https://movida.bebanjo.net/api/schedulings/46/workflow"
If everything runs fine, you will get a representation of the workflow with the status attribute which value is “sent”, which means that the scheduling has been sent to Sequence:
<?xml version="1.0" encoding="UTF-8"?>
<workflow>
<status>sent</status>
</workflow>
{
"resource_type": "workflow",
"status": "sent"
}
After a few seconds you can check for the workflow in the same URL:
$ curl --digest -u robot_user:password "https://movida.bebanjo.net/api/schedulings/46/workflow"
$ curl --digest -u robot_user:password -H "Accept: application/json" "https://movida.bebanjo.net/api/schedulings/46/workflow"
<?xml version='1.0' encoding='utf-8' ?>
<workflow>
<status>pending</status>
<link rel="job" href="https://sequence.example.com/api/work_areas/37/jobs/48394"/>
</workflow>
{
"resource_type": "workflow",
"status": "pending",
"job_link": "https://sequence.example.com/api/work_areas/37/jobs/48394"
}
Additionally, you can set the workflow’s template URL like in the UI when sending a scheduling to Sequence. This will generate a job in Sequence with the same list of tasks as the specified template.
<?xml version="1.0" encoding="UTF-8"?>
<workflow>
<template_url>https://sequence.bebanjo.net/api/templates/1</template_url>
</workflow>
{
"resource_type": "workflow",
"template_url": "https://sequence.bebanjo.net/api/templates/1"
}
If an invalid template URL is set, you will receive the following error:
<?xml version="1.0" encoding="UTF-8"?>
<error>
<message type="array">
<message>Workflow template url is not a valid url, please visit /api/templates endpoint in Sequence to get a valid template url</message>
</message>
</error>
{
"resource_type": "error",
"message": [
"Workflow template url is not a valid url, please visit /api/templates endpoint in Sequence to get a valid template url"
]
}
Please, refer to the job page to get more information about jobs.