Request Description
Precautions
- The file download link returned by the interface will generally be deleted at 24 o'clock the next day. Please download and store it in time.
- When calling the interface, please pay attention to the parameter transmission method of the corresponding interface in the document, and whether you need to carry Token to prevent parameter confusion.
- An HTTP status of 200 indicates that your HTTP request is successful, which does not mean that the file process successfully.
Description of Asynchronous Task Processing
To meet the needs of users for high concurrency, the ComPDFKit API uses a message queue asynchronously to process task requests by default to ensure the high availability of the API.
Interface Type | Request Method | Results Return Method | Pros and Cons |
---|---|---|---|
Asynchronous | After sending a request, there is no need to wait for the task to finish processing, and the result is obtained actively at once | Get the recognition results by querying the task result interface | When the concurrency is large, the success rate is high; when the network transmission is slow or not particularly stable, it is more stable |
Request PDF Tool List
This interface is used to obtain the collection of all PDF tools supported by the ComPDFKit 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/v1/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"
}
......
}
Create Task
A task ID is automatically generated for you based on the type of PDF tool you choose. You can provide the callback notification URL. After the task processing is completed, we will notify you of the task result through the callback interface. You can perform other operations according to the task result, such as downloading the result file.
Request method
- Request method: GET
- Parameter transfer method: Path
Path parameter
Parameter | Data Type | Description | Required |
---|---|---|---|
executeTypeUrl | String | Type of execution task | yes |
Request parameter
Parameter | Data Type | Description | Required |
---|---|---|---|
language | Integer | Interface error prompt language (1, English, 2, Chinese) | no |
Request address
https://api-server.compdf.com/server/v1/task/{executeTypeUrl}
Return parameter
Parameter | Data Type | Description |
---|---|---|
taskId | String | task id |
"code": "200",
"msg": "success",
"data": {
"taskId": "2da9dc86-5f41-4991-b9da-bc8434f64cc5"
}
Upload Files
Upload the original file and bind the file to the task ID. The field parameter is used to pass the JSON string to set the processing parameters for the file. Each file will generate automatically a unique filekey. Please note that a maximum of five files can be uploaded for a task ID and no files can be uploaded for that task after it has started.
Request Method
- Request method: POST
- Parameter transfer method: Body (form-data)
Request Parameter
Parameter | Data Type | Description | Required |
---|---|---|---|
file | File | Uploaded file | yes |
taskId | String | Task id | yes |
password | String | Password | no |
parameter | String | File processing parameters | no |
image | File | Watermark image(This parameter needs to be added when adding an image watermark) | no |
language | Integer | Interface error prompt language (1, English, 2, Chinese) | no |
Set the processing parameters only for the currently supported functions. If no parameter is set, the default value will be used. The JSON format corresponding to the different function types and the explanation of the fields are shown in the tool guides.
Request Address
https://api-server.compdf.com/server/v1/file/upload
Return Parameter
Parameter | Data Type | Description |
---|---|---|
fileKey | String | file unique identification |
fileUrl | String | file storage path |
"code": "200",
"msg": "success",
"data": {
"fileKey": "c6e0dcde-7533-4058-81fb-ea2a26677f85",
"fileUrl": "<fileUrl>"
}
Process Files
After the file upload is completed, call this interface with the task ID to process file.
Request Method
- Request method: GET
- Parameter transfer 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/v1/execute/start?taskId=<taskId>&language=<language>
Return parameter
Parameter | Data Type | Description |
---|---|---|
taskId | String | task id |
"code": "200",
"msg": "success",
"data": {
"taskId": "135e8570-6377-4660-94d2-867952796f2c"
}
Download Files
Get the download link of the corresponding result file according to the filekey of each file.
Request Method
- request method: GET
- parameter transfer method: Query
Request parameter
Parameter | Data Type | Description | Required |
---|---|---|---|
fileKey | String | File unique identification | yes |
language | Integer | Interface error prompt language (1, English, 2, Chinese) | no |
Request Address
https://api-server.compdf.com/server/v1/file/fileInfo?fileKey={fileKey}&language=<language>
Return Parameter
Parameter | Data Type | Description |
---|---|---|
fileKey | String | File unique identification |
taskId | String | Task id |
fileName | String | Original file name |
downFileName | String | Down File Name |
fileUrl | String | Original file address |
downloadUrl | String | Transfer download address |
sourceType | String | Source file format |
targetType | String | Target file format |
fileSize | Long | File size |
convertSize | Long | Convert success size |
convertTime | Long | Conversion time |
status | String | File Conversion Status |
failureCode | String | Failure reason code |
failureReason | String | Failure reason |
fileParameter | String | File processing parameters |
"code": "200",
"msg": "success",
"data": {
"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\"}"
}
Note:
status
:File Conversion Status
Status | Description |
---|---|
created | File upload succeeded |
processing | File conversion in progress |
success | File conversion succeeded |
failed | File conversion failed |
overdue | File saving expired, file deletion |
Get Task Information
Request task status and file-related metadata based on the task ID.
Request Method
- Request method: GET
- Parameter transfer 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/v1/task/taskInfo?taskId={taskId}&language=<language>
Return Parameter
Parameter | Data Type | Description |
---|---|---|
taskId | String | Task id |
taskFileNum | Integer | Number of task files |
taskSuccessNum | String | Number of successes |
taskFailNum | String | Number of failures |
taskStatus | String | Task status |
assetTypeId | String | Use Asset Type |
taskCost | String | Task cost |
taskTime | Long | Task duration |
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\"}"
}
]
}
Note:
taskStatus
:Task processing status
Status | Description |
---|---|
TaskStart | Task created successfully |
TaskWaiting | Task waiting for processing |
TaskProcessing | The task is being processed |
TaskFinish | Task processing completed |
TaskOverdue | Task waiting for processing 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/v1/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/v1/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
}