Watermark-API Interface
Last Updated:2020-09-21
Create Watermark
Request
-
Request syntax:
POST /v{version}/watermark HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: {utc-date-string} host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: {bce-request-id} content-type: application/json authorization: {bce-authorization-string}
- Request header: No special Header parameter
- Request parameter (the followings are Requestbody parameters):
Field name | Field type | Necessity | Field description | Optional value | Default value |
---|---|---|---|---|---|
bucket | String | Required | Store watermarked file Bucket on BOS | - | - |
key | String | Required | Store watermarked file key on BOS, support JPG, PNG, APNG, BMP, PBM, TIF, GIF, MOV and other formats, among which MOV, GIF and APNG are dynamic watermark | - | - |
verticalAlignment | String | Optional | Vertical alignment method | top, center, bottom | top |
horizontalAlignment | String | Optional | Horizontal alignment | left, center, right | left |
verticalOffsetInPixel | Number | Optional | Vertical offset, the parameter is valid only when verticalAlignment is set to top or bottom, with the unit of: Pixel | 0 ~ 3072 | 0 |
horizontalOffsetInPixel | Number | Optional | Horizontal offset, the parameter is valid only when horizontalAlignment is set to left or right, with the unit of: Pixel | 0 ~ 4096 | 0 |
timeline | Object | Optional | The watermark displays the start and end time effectively (only when watermarkId is set in the multiple watermark parameter of Preset.watermarks.image, the field can take effect) | - | - |
+ startTimeInMillisecond | Number | Optional | The watermark displays the start and end time, with the unit of: Millisecond | Greater than or equal to 0 | -(If it is null, it indicates to start from 0s) |
+ durationInMillisecond | Number | Optional | The watermark displays the duration, with the unit of: Millisecond | Greater than or equal to 0 | -(When it is empty, it means video duration.) |
repeated | Number | Optional | (Dynamic) The watermark displays the number of times repeatedly (only when watermarkId is set in the multiple watermark parameter of Preset.watermarks.image, the field can take effect) | Greater than or equal to 0 | 1 |
allowScaling | Bool | Optional | Whether it is allowed to scale automatically (only when watermarkId is set in the multiple watermark parameter of Preset.watermarks.image, the field can take effect) | true、false | true |
-
Request example:
POST /v3/watermark HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: 2015-03-24T13:08:44Z host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: d97c57d0-ca44-4d1c-bfeb-941a92440968 content-type: application/json authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:08:44Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9 { "bucket" : "samplebucket", "key" : "samplefolderpath/samplewatermark.png", "verticalOffsetInPixel" : 0, "horizontalOffsetInPixel" : 0 }
Response
- Response header: No special Header parameter
- Response parameter:
Field name | Field type | Field description |
---|---|---|
watermarkId | String | Unique identification of the watermark |
-
Response example:
HTTP/1.1 200 OK Transfer-Encoding: chunked x-bce-request-id: d97c57d0-ca44-4d1c-bfeb-941a92440968 Cache-Control: no-cache Server: BWS Date: Tue, 24 Mar 2015 13:34:07 GMT Content-Type: application/json;charset=UTF-8 { "watermarkId" : "wmk-lsdspxdastmnbama" }
Query Assigned Watermark
Request
-
Request syntax:
GET /v{version}/watermark/{watermarkId} HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: {utc-date-string} host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: {bce-request-id} content-type: application/json authorization: {bce-authorization-string}
- Request header: No special Header parameter
- Request parameter: None
-
Request example:
POST /v3/watermark/wmk-lsdspxdastmnbama HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: 2015-03-24T13:08:44Z host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: 9c1f8229-a8d4-46e1-b8e2-25412e0eee63 content-type: application/json authorization: bce-auth-v1/535f3834e538448aa88f3c589bab2ea3/2015-03-24T13:08:44Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9
Response
- Response header: No special Header parameter
- Response parameter: Please remain consistent with [Create Watermarks/Request/Request Parameters], and add the following fields
Field name | Field type | Field description |
---|---|---|
watermarkId | String | Unique identification of the watermark |
createTime | Date | Creation time of watermark |
-
Response example:
HTTP/1.1 200 OK Transfer-Encoding: chunked x-bce-request-id: 9c1f8229-a8d4-46e1-b8e2-25412e0eee63 Cache-Control: no-cache Server: BWS Date: Tue, 24 Mar 2015 13:34:07 GMT Content-Type: application/json;charset=UTF-8 { "watermarkId" : "wmk-lsdspxdastmnbama", "createTime": "2015-05-11T12:42:21Z", "bucket" : "samplebucket", "key" : "samplefolderpath/samplewatermark.png", "verticalOffsetInPixel" : 0, "horizontalOffsetInPixel" : 0 }
Query the Watermark of the Current User
Request
-
Request syntax:
GET /v{version}/watermark HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: {utc-date-string} host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: {bce-request-id} content-type: application/json authorization: {bce-authorization-string}
- Request header: No special Header parameter
- Request parameter: None
-
Request example:
GET /v3/watermark HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: 2015-03-24T13:08:44Z host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: 249ac308-4554-4825-ab0f-867dd92024d8 content-type: application/json authorization: bce-auth-v1/02296dd93f1940a39913d9a406332486/2015-03-24T13:08:44Z/1800/host;x-bce-date/cef8a3207e29c4663292c42665de1154e760c734f82248b36a71be2bb3281b1d
Response
- Response header: No special Header parameter
- Response parameter: Please remain consistent with [Create Watermarks/Request/Request Parameters], and add the following fields
Field name | Field type | Field description |
---|---|---|
watermarkId | String | Unique identification of the watermark |
createTime | Date | Creation time of watermark |
-
Response example:
HTTP/1.1 200 OK Transfer-Encoding: chunked x-bce-request-id: 249ac308-4554-4825-ab0f-867dd92024d8 Cache-Control: no-cache Server: BWS Date: Tue, 24 Mar 2015 13:34:07 GMT Content-Type: application/json;charset=UTF-8 { "watermarks": [ { "watermarkId" : "wmk-lsdspxdastmnbama", "createTime": "2015-05-11T12:42:21Z", "bucket" : "samplebucket", "key" : "samplefolderpath/samplewatermark.png", "verticalOffsetInPixel" : 0, "horizontalOffsetInPixel" : 0 } { "watermarkId" : "wmk-feji7exr57r3824x", "createTime": "2015-05-07T12:34:20Z", "bucket" : "samplebucket", "key" : "samplefolderpath/samplewatermark1.png", "verticalOffsetInPixel" : 150, "horizontalOffsetInPixel" : 40 } { "watermarkId" : "wmk-lsdspxdastmnbama", "createTime": "2015-05-08T12:22:15Z", "bucket" : "samplebucket2", "key" : "samplefolderpath/samplewatermark.png", "verticalOffsetInPixel" : 0, "horizontalOffsetInPixel" : 200 } ] }
Delete Watermark
Request
-
Request syntax:
DELETE /v{version}/watermark/{watermarkId} HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: {utc-date-string} host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: {bce-request-id} content-type: application/json authorization: {bce-authorization-string}
- Request header: No special Header parameter
- Request parameter: None
-
Request example:
DELETE /v3/watermark/wmk-lsdspxdastmnbama HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: 2015-03-24T13:08:44Z host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: f922935d-cf8a-4078-a43a-dc3475ab3a70 content-type: application/json authorization: bce-auth-v1/535f3834e538448aa88f3c589bab2ea3/2015-03-24T13:08:44Z/1800/host;x-bce-date/19468bb170d1073c5cdd292f4424d80d259d0a17528648426f305d39a2d6c452
Response
- Response header: No special Header parameter
- Response parameter: None
-
Response example:
HTTP/1.1 200 OK x-bce-request-id: f922935d-cf8a-4078-a43a-dc3475ab3a70 Cache-Control: no-cache
Common Exception
The watermark does not exist
- Abnormal code: 404
- Exceptional fields: watermark: XXXX does not exist
- Cause: 1.Try to query/delete the watermark nonexistent (un-created/deleted) 2.A non-existent watermark is used to create a transcoding template
Inexistent watermark image
- Abnormal code: 404
- Exceptional fields: bos object: XXXX does not exist
- Cause: 1.Use the inexistent bos object when creating the watermark 2.Inexistent bos object is introduced when creating a job (transcoding the source video or watermark image)
The watermark cannot be deleted
- Abnormal code: 400
- Exceptional fields: watermark is in use, please delete the relative presets first
- Cause: 1.The watermark to be deleted is used by the currently active preset, and the users are suggested to delete the corresponding preset
Add watermark under Transmux mode
- Abnormal code: 400
- watermark is not supported in Transmux mode
- Cause: 1.An attempt is made to add watermark under the Transmux mode, which does not need to recode, so the watermark cannot be added