Updated on 2024-07-30 GMT+08:00

Creating a Batch Task

Function

Create a batch task.

URI

POST /koodrive/ose/v1/jobs

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Authorization

Yes

String

Access token. Token authentication is used to call KooDrive APIs. A token indicates the permission. When an API is called, the token is added to the request header to obtain the operation permission. For details about how to obtain an access token, see the corresponding developer guide. The format is Bearer+{access_token}.

X-Traceid

No

String

Message log trace ID. The value contains 58 bits.

language

No

String

Language code, which complies with the internationalization specifications. For example, en-US indicates English (United States). English (United States) is used by default.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

taskType

Yes

Integer

Task type.

  • 1: batch replication.

  • 2: batch deletion.

  • 3: batch relocation.

  • 4: batch restoration of recycle bin data.

  • 5: cloud decompression.

  • 6: package download.

actionType

No

Integer

Operation type, which is a subdivision of taskType. This parameter is used only when taskType is set to 1, 2, or 3.

  • 101: replication and dumping.

  • 201: logical deletion (moved to the recycle bin).

  • 202: permanent deletion.

  • 301: common relocation.

  • 501: compressed package preview.

  • 502: full decompression.

  • 503: partial decompression.

taskInfo

Yes

CreateTaskInfoReq object

Request for creating a batch task.

dstContainerId

Yes

String

Target space ID.

password

No

String

Compressed package password.

Table 3 CreateTaskInfoReq

Parameter

Mandatory

Type

Description

fileInfo

Yes

Array of fileInfo objects

File/Directory ID.

newFilePath

No

String

New file path.

srcContainerId

Yes

String

Source space ID.

uncompressFilePaths

No

Array of strings

List of full paths of partially decompressed files in the compressed package.

Table 4 fileInfo

Parameter

Mandatory

Type

Description

fileId

Yes

String

File ID.

filePath

No

String

Full file path, including fileId.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

code

String

Error code.

msg

String

Error message.

data

String

Task ID.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

code

String

Response code.

msg

String

Response description.

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

code

String

Response code.

msg

String

Response description.

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

code

String

Response code.

msg

String

Response description.

Example Requests

Request for copying files.

POST /koodrive/ose/v1/jobs

Authorization:Bearer+10f88d07fa************44791e9ff
{
    "taskType":1 ,
    "actionType":101 ,
    "dstContainerId": "IAADfsBFCO6WtAtuA315074383680425b8aa9a130cba2d4" ,
    "taskInfo": {
        "srcContainerId": "IAADfsBFCO6WtAtuA315074383680425b8aa9a130cba2d4",
        "newFilePath": "Fm9UdqBNTAQDos6l1xPlFnIqXJg2-UdqA" ,
        "fileInfo": [
            {
                "fileId": "FuZmQ66CF0DdpKRG1Y29Iwajbq04Nhwu3"  
            }
        ]
    }
}

Example Responses

Status code: 200

Basic response. Only the error code and error information are returned.

{
    "data": "1309243162258308352"
    "code": 0,
    "msg": "success"
}

Status Codes

Status Code

Description

200

Basic response. Only the error code and error information are returned.

400

Bad Request

401

Unauthorized

500

Internal Server Error