Help Center/ Data Security Center/ API Reference/ API Description/ Document Watermarking/ Extracting Invisible Watermarks from Documents (Document Addresses)
Updated on 2023-12-07 GMT+08:00

Extracting Invisible Watermarks from Documents (Document Addresses)

Function

This API is used to extract invisible text watermarks from Word (.docx), PPT (.pptx), Excel (.xlsx), and PDF (.pdf) documents. You need to pass the address of a watermarked document (only OBS path is supported) to this API. DSC returns the invisible text watermark extracted from the document in JSON format.

URI

POST /v1/{project_id}/doc-address/watermark/extract

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

region_id

Yes

String

ID of the region where the project is located, for example, xx-xx-1.

doc_type

Yes

String

Type of the document whose watermark is to be extracted.

Enumeration values:

  • WORD

  • EXCEL

  • PDF

  • PPT

src_file

Yes

String

Address of the document whose text watermark is to be extracted. Currently, only Huawei Cloudcloud service OBS objects are supported. The format is obs://bucket/object, where bucket indicates the name of the OBS bucket in the same region as the current project, and object indicates the full path name of the object. For example, obs://hwbucket/hwinfo/hw.doc.

file_password

No

String

Password for opening a file, which can contain a maximum of 256 characters. If an Office Word document requires a password for read or domain control, you need to enter the password to open the file.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

watermark

String

Invisible watermark. The length cannot exceed 32 characters.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error Message

Example Requests

Extract the invisible watermark from the Word document at obs://hwbucket/hwinfo/hw.docx.

POST /v1/{project_id}/doc-address/watermark/extract

{
  "region_id" : "xx-xx-1",
  "src_file" : "obs://hwbucket/hwinfo/hw.docx",
  "doc_type" : "WORD"
}

Example Responses

Status code: 200

Request succeeded.

{
  "watermark" : "blind_watermark"
}

Status code: 400

Invalid request.

{
  "error_code" : "DSC.00000007",
  "error_msg" : "File format error"
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Invalid request.

Error Codes

See Error Codes.