Submitting a Job

A job is submitted to a factory and processed using a template. The template determines the inputs that are required and the factory determines where the outputs are delivered. The API request provides the input and output file locations for the job.

For example use the following command to submit a job to the template we created in the previous topic. The template requires input1 and produces output1:

curl --location --request POST 'https://api.cloud.telestream.net/transform/v1.0/factories/FACTORY_ID/jobs' \
--header 'X-Api-Key: tcs_YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "template_id": "TEMPLATE_ID",
  "inputs": {
    "input1": {
      "url": "https://storage.googleapis.com/debug_videos/tears.mp4"
    }
  },
  "outputs": {
    "output1": {
      "path_format": "$job_id$_$date$.mp4"
    }
  }
}'

If the command is successful the response will include the job ID as shown below. You will need the ID to get the progress of the job in the future.

{
  "account_id": "YOUR_ACCOUNT_ID",
  "created_at": "2021-02-25T23:10:58.568554133Z",
  "updated_at": "2021-02-25T23:10:58.568554133Z",
  "factory_id": "FACTORY_ID",
  "id": "JOB_ID",
  "inputs": {
    "input1": {
    }
  },
  "outputs": {
    "output1": {
    }
  },
  "processing_duration": null,
  "processing_progress": 0,
  "queued_duration": null,
  "composition": {
  },
  "status": "queued",
  "template_id": "YOUR_TEMPLATE_ID",
  "uploading_duration": null,
  "uploading_progress": 0
}

For a list of job possible job states, see: https://docs.telestream.dev/reference#job-1

Use the following command to list the jobs (running and complete) in a factory:

curl -H 'X-Api-Key: tcs_YOUR_API_KEY' https://api.cloud.telestream.net/transform/v1.0/factories/FACTORY_ID/jobs

Use the following command to request the progress of an existing job:

curl -H 'X-Api-Key: tcs_YOUR_API_KEY' https://api.cloud.telestream.net/transform/v1.0/factories/FACTORY_ID/jobs/JOB_ID

Did this page help you?