A TargetURI template is used to dynamically generate URIs. In the template, specific placeholders are provided and can be replaced with actual values. Example: oss://{bucket}/{tags.custom}/{dirname}/{barename}.{autoext}
.
Syntax
Similar to the string format in Python 3, variables of a TargetURI template are enclosed in braces.
The variables include public variables and operator-specific variables. These built-in variables can be directly referenced in the default namespace.
Some variables come from the Tags parameter in a request. These variables are all in the tags namespace.
If you want to carry brace-enclosed content in the output, use double braces for escaping, in the format of
{{ => {,}} => }
.
Public variables
Variable | Description | Example |
bucket | The name of the bucket to which the object is uploaded. | test-bucket |
key | The name of the object stored in the bucket, which is equivalent to | path1/path2/name.png |
dirname | The path of the object. | path1/path2 |
barename | The name of the original file to upload, excluding the suffix. | name |
basename | The name of the original file to upload, including the suffix. | name.png |
ext | The suffix of the original file to upload. The suffix is automatically obtained based on the Multipurpose Internet Mail Extensions (MIME) type or OssKey. | png |
year | The year when the object is uploaded, in the yyyy format. | 2022 |
mon | The month when the object is uploaded, in the mm format. | 04 |
day | The day when the object is uploaded, in the dd format. | 22 |
hour | The hour when the object is uploaded, in the HH format. | 14 |
min | The minute when the object is uploaded, in the MM format. | 38 |
sec | The second when the object is uploaded, in the SS format. | 25 |
t_year | The year when the task is created, in the yyyy format. | 2022 |
t_mon | The month when the task is created, in the mm format. | 04 |
t_day | The day when the task is created, in the dd format. | 22 |
t_hour | The hour when the task is created, in the HH format. | 14 |
t_min | The minute when the task is created, in the MM format. | 38 |
t_sec | The second when the task is created, in the SS format. | 25 |
Operator-specific variables
Related API operation: CreateOfficeConversionTask
Variable | Description | Example |
index | The subscript of the output document, starting from 1.
|
|
sheetname | If the source document is an Excel document, this variable indicates the name of the sheet. | sheet1 |
autoext | The filename extension of the output document. | jpg |