Presigned URL Request Description
Request PDF Tool List
This interface is used to obtain the collection of all PDF tools supported by the ComPDF API, and you can query the URL of each PDF tool.
Request Method
- Request method: GET
- Parameter transfer method: Query
Request Address
https://api-server.compdf.com/server/v2/tool/support
Return Parameter
| Parameter | Data Type | Description |
|---|---|---|
| sourceTypeName | String | Source file format |
| targetTypeName | String | Destination file format |
| executeTypeUrl | String | Type of execution task |
"code": "200",
"msg": "success",
"data": {
{
"sourceTypeName": "pdf",
"targetTypeName": "docx",
"executeTypeUrl": "pdf/docx"
},
{
"sourceTypeName": "pdf",
"targetTypeName": "jpg",
"executeTypeUrl": "pdf/jpg"
},
{
"sourceTypeName": "doc",
"targetTypeName": "pdf",
"executeTypeUrl": "doc/pdf"
}
......
}Get Presigned URL for Task
Obtain a presigned URL and task ID. You can use the returned presigned URL to upload files locally without sending them directly to the server.
Request Method:
- Request method: POST.
- Parameter transmission method: Body (form-data).
Request Parameters:
| Parameter Name | Data Type | Description | Required |
|---|---|---|---|
| executeTypeUrl | String | Tool type | Yes (either this or taskId must be provided) |
| taskId | String | Task ID | Yes (either this or executeTypeUrl must be provided) |
| fileName | String | Uploaded file name | Yes |
| password | String | File password | No |
| parameter | String | File processing parameters | No |
| language | Integer | Interface error prompt language (1: English, 2: Chinese) | No |
- On the first request, pass in
executeTypeUrl, and the interface will create a new task and return ataskId. - For subsequent file uploads to the same task, pass in
taskIdwithout needing to provideexecuteTypeUrlagain. - The Parameter field is only for functions that currently support setting processing parameters. If no parameters are set, the default values will be used. The JSON format and field explanations corresponding to different function types can be found in the specific tool guides.
Request URL:
https://api-server.compdf.com/server/v2/presignedUrl
Return Parameters:
| Return Parameter | Data Type | Description |
|---|---|---|
| taskId | String | Task ID |
| presignedUrl | String | Presigned URL |
{
"code": "200",
"msg": "success",
"data": {
"taskId": "401852da-cca5-475e-b475-2bd259f273d5",
"presignedUrl": "<presignedUrl>"
}
}cURL Example:
curl --location --request POST 'https://api-server.compdf.com/server/v2/presignedUrl?language=2' \
--header 'x-api-key: public_key' \
--form 'executeTypeUrl="pdf/docx"' \
--form 'taskId=""' \
--form 'fileName="test.pdf"' \
--form 'password=""' \
--form 'parameter=""' \
--form 'language=""'Upload File via Presigned URL
After obtaining the presigned URL, you can use it to upload files directly. The upload requires a PUT request, sending the file as a binary stream.
Request Method:
- Request method: PUT.
- Parameter transmission method: Body (binary).
Request URL:
The returned presigned URL (presignedUrl field).
Request Headers:
| Header | Value |
|---|---|
| Content-Type | application/octet-stream |
| Accept | */* |
| Connection | keep-alive |
Request Body:
Binary data of the file to upload.
cURL Example:
curl --location --request PUT '<presignedUrl>' \
--header 'Content-Type: application/octet-stream' \
--header 'Accept: */*' \
--header 'Connection: keep-alive' \
--data-binary '@file.pdf'Execute Task
After all files have been uploaded, call this interface to start the task processing.
Request Method:
- Request method: GET.
- Parameter transmission method: Query.
Request Parameters:
| Parameter Name | Data Type | Description | Required |
|---|---|---|---|
| taskId | String | Task ID | Yes |
| language | Integer | Interface error prompt language (1: English, 2: Chinese) | No |
Request URL:
https://api-server.compdf.com/server/v2/execute/start?taskId={taskId}&language={language}
Return Parameters:
| Return Parameter | Data Type | Description |
|---|---|---|
| taskId | String | Task ID |
"code": "200",
"msg": "success",
"data": {
"taskId": "f416dbcf-0c10-4f93-ab9e-a835c1f5dba1"
}Get Task Information
Request task status and file-related metadata based on the task ID.
Request Method:
- Request method: GET.
- Parameter transmission method: Query.
Request Parameter:
| Parameter | Data Type | Description | Required |
|---|---|---|---|
| taskId | String | Task ID | Yes |
| language | Integer | Interface error prompt language (1: English, 2: Chinese) | No |
Request Address
https://api-server.compdf.com/server/v2/task/taskInfo?taskId={taskId}
Return Parameters:
| Return Parameter | Data Type | Description |
|---|---|---|
| taskId | String | Task ID |
| taskFileNum | Integer | Number of task files |
| taskSuccessNum | String | Number of successful ones |
| taskFailNum | String | Number of failed ones |
| taskStatus | String | Task status |
| assetTypeId | String | Asset type used |
| taskCost | String | Task cost |
| taskTime | Long | Task duration (ms) |
| sourceType | Long | Source file format |
| targetType | Long | Target file format |
| fileInfoDTOList | List | Task file information |
"code": "200",
"msg": "success",
"data": {
"taskId": "f416dbcf-0c10-4f93-ab9e-a835c1f5dba1",
"taskFileNum": 1,
"taskSuccessNum": 1,
"taskFailNum": 0,
"taskStatus": "TaskFinish",
"assetTypeId": 0,
"taskCost": 1,
"taskTime": 1,
"sourceType": "pdf",
"targetType": "docx",
"fileInfoDTOList": [
{
"fileKey": "ba13a2a8-1278-43d4-a9a6-7ecc28a0804f",
"taskId": "f416dbcf-0c10-4f93-ab9e-a835c1f5dba1",
"fileName": "test.pdf",
"downFileName": "test.docx",
"fileUrl": "<fileUrl>",
"downloadUrl": "<downloadUrl>",
"sourceType": "pdf",
"targetType": "docx",
"fileSize": 24475,
"convertSize": 6922,
"convertTime": 8,
"status": "<status>",
"failureCode": "",
"failureReason": "",
"fileParameter": "{ \"pageOptions\": \"3\"}"
}
]
}Remarks:
taskStatus: Task processing status
| Status Content | Status Description |
|---|---|
| TaskStart | Task created successfully |
| TaskWaiting | Task waiting for processing |
| TaskProcessing | Task is being processed |
| TaskFinish | Task processing completed |
| TaskOverdue | Task waiting timeout |
Get Asset Details
Get the remaining assets of the current user.
Request Method
- Request method: GET
- Parameter transfer mode: Query
Request Address
https://api-server.compdf.com/server/v2/asset/info
Return Parameter
| Return Parameter | Data Type | Description |
|---|---|---|
| tenantAsset | List | Asset Information |
| assetTypeName | String | Asset Type |
| asset | Integer | Asset balance |
| withholdingAsset | Integer | Total withholding assets |
"code": "200",
"msg": "success",
"data": {
"tenantAsset": [
{
"assetTypeName": "SUBSCRIPTIONS",
"asset": 12,
"withholdingAsset": 0
},
{
"assetTypeName": "PACKAGES",
"asset": 1,
"withholdingAsset": 0
}
]
}Get Task List
Request the current user file transfer task list.
Request Method
- Request method: GET
- Parameter transfer mode: Query
Request Parameter
page:Pagination- Current number of pages, not required, default to 1 if not filled.size:Pagination- The number of items displayed on the page, not required, the default is 10 if not filled.
| Parameter | Data Type | Description | Required |
|---|---|---|---|
| page | Long | Current page | No (If not filled, the default is 1) |
| size | Long | Number of pages | No (If not filled, the default is 10) |
Request Address
https://api-server.compdf.com/server/v2/task/list
Return Parameter
| Parameter | Data Type | Description |
|---|---|---|
| createdBy | String | Founder |
| updatedBy | String | Updater |
| creationTime | LocalDateTime | Creation time |
| updateTime | LocalDateTime | Update time |
| id | Long | Task primary key id |
| taskId | String | Task id |
| taskUrl | taskUrl | Task original folder |
| taskLoadUrl | String | Task conversion folder |
| taskFileNum | Integer | Number of task files |
| taskSuccessNum | Integer | Number of successes |
| taskFailNum | Integer | Number of failures |
| taskStatus | String | Task status |
| assetTypeId | Integer | Working with asset types |
| taskCost | Integer | Task cost |
| taskTime | Long | Task duration |
| callbackUrl | String | Callback address |
| server | String | Server address |
| sourceType | String | Source file format |
| targetType | String | Target file format |
| tenantId | Long | Tenant id |
{
"records": [
{
"createdBy": null,
"updatedBy": null,
"creationTime": "2022-08-31 15:06:20",
"updateTime": "2022-08-31 15:14:44",
"id": 771751854513061888,
"taskId": "a300c232-0a2d-4e3c-95f2-cfb4604b2018",
"taskUrl": "",
"taskLoadUrl": "",
"taskFileNum": 3,
"taskSuccessNum": 0,
"taskFailNum": 0,
"taskStatus": "TaskFinish",
"assetTypeId": 0,
"taskCost": 3,
"taskTime": 0,
"callbackUrl": "",
"server": "",
"sourceType": "pdf",
"targetType": "docx",
"tenantId": 1
},
{
"createdBy": null,
"updatedBy": null,
"creationTime": "2022-08-31 15:25:24",
"updateTime": "2022-08-31 15:26:17",
"id": 771756653954465793,
"taskId": "e74d60a6-fbd3-4d7d-9efa-0dc70297ee0b",
"taskUrl": "",
"taskLoadUrl": "",
"taskFileNum": 3,
"taskSuccessNum": 3,
"taskFailNum": 0,
"taskStatus": "TaskFinish",
"assetTypeId": 0,
"taskCost": 3,
"taskTime": 3,
"callbackUrl": "",
"server": "",
"sourceType": "pdf",
"targetType": "docx",
"tenantId": 1
}
],
"total": 528,
"size": 2,
"current": 1,
"orders": [],
"optimizeCountSql": true,
"searchCount": true,
"countId": null,
"maxLimit": null,
"pages": 264
}