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

Batch Asset Operations

Function

Performs batch asset operations.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/digital-assets/batch-action

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used.

You can obtain the token by calling the IAM API used to obtain a user token.

Value of X-Subject-Token in the response header.

Authorization

No

String

Authentication information. This parameter is mandatory for AK/SK authentication.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory for AK/SK authentication.

The format is YYYYMMDD'T'HHMMSS'Z'.

X-App-UserId

No

String

Third-party user ID, which does not allow Chinese characters.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Batch operation command.

  • DELETE: deletion

  • DELETE_FORCE: forcible deletion. An asset is deleted immediately.

  • RESTORE: restoration

  • UNACTIVE: deactivation

  • ACTIVE: activation

  • SHARE: sharing

  • UNSHARE: canceling sharing

asset_ids

Yes

Array of strings

Asset IDs

params

No

String

Operation parameter

Response Parameters

Status code: 200

Table 4 Response header parameters

Parameter

Type

Description

X-Request-Id

String

Request ID.

Table 5 Response body parameters

Parameter

Type

Description

results

Array of AssetActionResult objects

Batch operation result

Table 6 AssetActionResult

Parameter

Type

Description

ret_status

String

Handling status.

  • SUCCESS

  • FAILED

asset_ids

Array of strings

Asset IDs

error_info

ErrorResponse object

Error message

Table 7 ErrorResponse

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

POST https://{endpoint}/v1/digital-assets/batch-action

{
  "action" : "DETELTE",
  "asset_ids" : [ "xxxxx1", "xxxxx2", "xxxxx3", "xxxxx4" ]
}

Example Responses

Status code: 200

Succeeded.

{
  "results" : [ {
    "ret_status" : "SUCESS",
    "asset_ids" : [ "xxxxx1", "xxxxx2" ]
  }, {
    "ret_status" : "FAILED",
    "asset_ids" : [ "xxxx3", "xxxx4" ],
    "error_info" : {
      "error_code" : "MSS.xxxxxx",
      "error_msg" : "Insufficient permissions."
    }
  } ]
}

Status code: 400

{
  "error_code" : "MSS.00000001",
  "error_msg" : "Unauthorized"
}

Status code: 500

{
  "error_code" : "MSS.00000004",
  "error_msg" : "Internal Error"
}

Status Codes

Status Code

Description

200

Succeeded.

400

Authentication is not performed or fails.

500

Internal service error.

Error Codes

See Error Codes.