A TargetURI template dynamically generates a URI by replacing placeholders with actual values during processing. For example: oss://{bucket}/{tags.custom}/{dirname}/{barename}.{autoext}.
Syntax
-
Similar to the string
format()method in Python 3, variables are enclosed in curly braces. -
Variables include public variables and operator-specific variables. You can reference these built-in variables directly in the default namespace.
-
Variables can also be derived from the Tags parameter in a request. These variables are located in the
tagsnamespace. -
To output literal curly braces, escape them by doubling them, such as
{{for { and}}for }.
Public variables
|
Parameter |
Description |
Example |
|
bucket |
The name of the destination bucket. |
test-bucket |
|
key |
The object key in the bucket. This is equivalent to |
path1/path2/name.png |
|
dirname |
The object path, without the filename. |
path1/path2 |
|
barename |
The original filename without the extension. |
name |
|
basename |
The original filename with the extension. |
name.png |
|
ext |
The file extension of the uploaded object. The extension is derived from the detected MIME type or the object key. |
png |
|
year |
The year the object was uploaded, in |
2022 |
|
mon |
The month the object was uploaded, in |
04 |
|
day |
The day the object was uploaded, in |
22 |
|
hour |
The hour the object was uploaded, in |
14 |
|
min |
The minute the object was uploaded, in |
38 |
|
sec |
The second the object was uploaded, in |
25 |
|
t_year |
The year the task was created, in |
2022 |
|
t_mon |
The month the task was created, in |
04 |
|
t_day |
The day the task was created, in |
22 |
|
t_hour |
The hour the task was created, in |
14 |
|
t_min |
The minute the task was created, in |
38 |
|
t_sec |
The second the task was created, in |
25 |
Operator-specific variables
The following variables are available for an office conversion task.
|
Parameter |
Description |
Example |
|
index |
The output index, starting from 1.
|
|
|
sheetname |
For Excel files, this is the worksheet name. |
sheet1 |
|
autoext |
The file extension of the output object. |
jpg |
The following variables are available for a media transcoding task.
|
Parameter |
Description |
Example |
|
streamindex |
The audio or video stream ID. The IDs for audio and video streams increment separately, starting from 0. This variable applies to multi-output scenarios, such as frame capturing, sprite generation, animated image creation, and audio transcoding. |
0 |
|
index |
The output file index, starting from 1. This variable applies to multi-output scenarios, such as segmented transcoding and frame capturing. |
1 |
|
resolution |
The transcoding resolution, available only for video transcoding. |
1920x1080 |
|
autoext |
The file extension of the output object. |
ts |