Upload Documents

Uploading Steps

1. Get the document uploading URL

Retrieve the fileUploadUrl with the specified API .

 

2. Upload the document

Upload the file using an HTTP PUT request with the URL obtained in Step 1.

 

Note:

  • contentMD5 is optional.
  • If contentType,contentMD5 is specified in Step 1, it must be included in the request headers in Step 2, and their values must exactly the same between the two steps.
  • The Content-Type values in both steps must be exactly the same, otherwise, a 403 error will occur.

Get Document Uploading URL

POST /esignglobal/v1/files/getUploadUrl

Interface Description

Get the file upload url through this interface.

Request Parameters

Parameter

Type

Required

Description

fileName

string

true

File Name

[Note]: The file extension must be included; otherwise, the request will fail during verification.

e.g., Contract Name 1.pdf

Supplementary Notes:

  1. The file extension must match the actual file type. For example, if the uploaded file is a PDF document, the parameter must be "xxx.pdf" rather than "xxx.docx".
  2. It is recommended to upload files in PDF format. For other file types, it is best to convert them to PDF locally to avoid format errors and delays due to interface-based format conversion.
  3. The file name must not contain the following nine special characters: / \ : * " < > | ? or any emojis.
  4. Only .pdf file formats are supported.

contentMD5

string

false

Content-MD5 value of the file

Supplementary note:

You need to generate the 128-bit binary MD5 hash of the file first, and then encode this binary value using Base64.

contentType

string

true

Content Type

Request Example

{
  "fileName": "测试.pdf",
  "contentType": "application/pdf"
}

Responses

Parameter

Type

Description

fileKey

string

File fileKey

fileName

string

File Name

fileUploadUrl

string

File Upload URL, valid for 60 minutes

[Note] Please request the interface to obtain the upload url again after expiration.

Response example

{
    "code": "0",
    "data": {
    "fileKey": "xxxxxxxxx",
      "fileName": "签署.pdf",
      "fileUploadUrl": "文件上传地址"
  },
  "message": "成功"
}

 

Upload Document

The fileUpload Url obtained with Get Document Uploading URL interface.

Interface Description

Upload the file(binary byte stream) using an HTTP PUT request with the URL obtained in Step 1.

Request Parameters

1.Headers

Parameter

Type

Required

Description

Content-MD5

string

false

Content-MD5 value of the file, should be exactly the same with the contentMD5 value in Step 1.

Content-Type

string

true

Content Type, should be exactly the same with the contentType value in Step 1.

2.HTTP BODY: binary byte stream of the file to be uploaded

3.Encode:

Request Example

fileName = URLEncoder.encode(fileName, "UTF-8");
// replace special characters
fileName = fileName
  .Replace All("\ \ +", "% 20")
. Replace All("% 28", "(")
. Replace All("% 29", ")")
. Replace All("% 27", "'")
.replaceAll("%21", "!")
  .replaceAll("%7E", "~");

Response Example

http_status: 200

 

 

Get Document Uploading URL
Interface Description
Request Parameters
Supplementary Notes:
Request Example
Responses
Response example
Upload Document
Interface Description
Request Parameters
Request Example
Response Example