Skip to content

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 certification 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.

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/v1/tool/support

Return Parameter

ParameterData TypeDescription
sourceTypeNameStringSource file format
targetTypeNameStringDestination file format
executeTypeUrlStringType of execution task
java
"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"
    }
    ......
}

File Processing

This is a simplified process interface for quick task processing according to the PDF tool type and parameters you select.

Request Method:

  • Request method: POST.
  • Parameter transmission method: Body (form-data).

Path Parameters:

Parameter NameData TypeDescriptionRequired
executeTypeUrlStringTool typeYes

Request Parameters:

Parameter NameData TypeDescriptionRequired
fileArray(File)Uploaded files (up to five are supported)Yes
passwordStringPasswordNo
parameterStringFile processing parametersNo
imageFileWatermark image (required when adding image watermark)No
languageIntegerInterface error prompt language (1: English, 2: Chinese)No

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 (Chapters 4~7 of this guide).

Request URL:

plaintext
https://api-server.compdf.com/server/v1/process/{executeTypeUrl}

Return Parameters:

Return ParameterData TypeDescription
taskIdStringTask ID
taskFileNumIntegerNumber of task files
taskSuccessNumStringNumber of successful ones
taskFailNumStringNumber of failed ones
taskStatusStringTask status
assetTypeIdStringAsset type used
taskCostStringTask cost
taskTimeLongTask duration (ms)
sourceTypeLongSource file format
targetTypeLongTarget file format
fileInfoDTOListListTask file information
java
"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 ContentStatus Description
TaskStartTask created successfully
TaskWaitingTask waiting for processing
TaskProcessingTask is being processed
TaskFinishTask processing completed
TaskOverdueTask 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/v1/asset/info

Return Parameter

Return ParameterData TypeDescription
tenantAssetListAsset Information
assetTypeNameStringAsset Type
assetIntegerAsset balance
withholdingAssetIntegerTotal withholding assets
java
"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.
ParameterData TypeDescriptionRequired
pageLongCurrent pageno(If not filled, the default is 1)
sizeLongNumber of pagesno(If not filled, the default is 10)

Request Address

https://api-server.compdf.com/server/v1/task/list

Return Parameter

ParameterData TypeDescription
createdByStringFounder
updatedByStringUpdater
creationTimeLocalDateTimeCreation time
updateTimeLocalDateTimeUpdate time
idLongTask primary key id
taskIdStringTask id
taskUrltaskUrlTask original folder
taskLoadUrlStringTask conversion folder
taskFileNumIntegerNumber of task files
taskSuccessNumIntegerNumber of successes
taskFailNumIntegerNumber of failures
taskStatusStringTask status
assetTypeIdIntegerWorking with asset types
taskCostIntegerTask cost
taskTimeLongTask duration
callbackUrlStringCallback address
serverStringServer address
sourceTypeStringSource file format
targetTypeStringTarget file format
tenantIdLongTenant id
java
{
        "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
        }