Creating a Template
A template has a name and a composition that describes the input and output files.
Use the following command to create a template in your account. In this example the composition simply converts (or rewraps) the input file to an MP4 output:
curl --location --request POST 'https://api.cloud.telestream.net/transform/v1.0/templates' \
--header 'X-Api-Key: tcs_YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Sample Template",
"composition": {
"input": {
"container": [
{
"name": "input1"
}
]
},
"output": {
"container": [
{
"name": "output1",
"type": "mp4 "
}
]
}
}
}'
If the command is successful Transform will respond with the validated composition and the ID of the newly created template as shown below. You will need the ID when submitting a job this this template.
{
"account_id": "YOUR_ACCOUNT_ID",
"created_at": "2021-02-25T21:51:30.58549488Z",
"updated_at": "2021-02-25T21:51:30.58549488Z",
"id": "YOUR_TEMPLATE_ID",
"name": "Sample Template",
"composition": {
"input": {
"container": [
{
"name": "input1",
"audio": null,
"subtitle": null,
"video": null
}
],
"reference": "input1"
},
"output": {
"container": [
{
"type": "mp4 ",
"name": "output1",
"audio": null,
"subtitle": null,
"video": null
}
]
}
},
"frontend_editable": false
}
Use the following command to list the templates in your account:
curl -H 'X-Api-Key: tcs_YOUR_API_KEY' 'https://api.cloud.telestream.net/transform/v1.0/templates'
If the command is successful the response will be similar to the following:
{
"page": 1,
"page_count": 1,
"per_page": 30,
"templates": [
{
"account_id": "YOUR_ACCOUNT_ID",
"created_at": "2021-02-25T21:51:31Z",
"updated_at": "2021-02-25T21:51:31Z",
"id": "TEMPLATE_ID",
"name": "Sample Template",
"composition": {
"input": {
"container": [
{
"name": "input1",
"audio": null,
"subtitle": null,
"video": null
}
],
"reference": "input1"
},
"output": {
"container": [
{
"type": "mp4 ",
"name": "output1",
"audio": null,
"subtitle": null,
"video": null
}
]
}
},
"frontend_editable": false
}
],
"total_count": 1
}
Updated about 1 year ago