Updated on 2023-06-29 GMT+08:00

Importing Assets

Function

  • This API is used to create an asset import task. The asset version and specific assets are read from the asset content. - A maximum of 100 applications and tasks are supported. - A user can create only one asset import job at a time. In other words, there should be no job in the Running state when the user creates such a job.

URI

POST /v2/{project_id}/instances/{instance_id}/assets/import

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Instance ID.

Minimum: 0

Maximum: 64

project_id

Yes

String

Project ID.

Minimum: 0

Maximum: 64

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

mode

No

String

Mode for importing asset files.

  • AddNew

  • Merge

    The default mode is AddNew.

prefix

No

String

Prefix of an application.

If a prefix is added, the prefix and the existing application name will be combined during asset import to generate a new application name. Then the asset is imported with the new name.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Minimum: 1

Maximum: 100000

Table 4 FormData parameters

Parameter

Mandatory

Type

Description

ImportAssetRequestBody

Yes

File

Asset file to be imported.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

job_id

String

ID of an asset import job, which can be used to query the job progress.

Minimum: 1

Maximum: 128

Status code: 403

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 1

Maximum: 128

error_msg

String

Error message.

Minimum: 1

Maximum: 128

error_details

String

Error information.

Minimum: 1

Maximum: 128

request_id

String

Request ID.

Minimum: 1

Maximum: 128

Example Requests

POST https://{endpoint}/v2/{project_id}/instances/{instance_id}/assets/import

{
  "ImportAssetRequestBody" : "assetname.zip"
}

Example Responses

Status code: 200

OK

{
  "job_id" : "ff8080814dbd65d7014dbe0d84db0013"
}

Status code: 403

Forbidden

{
  "error_code" : "ROMA.00000101",
  "error_msg" : "error summary",
  "error_details" : "some error details here",
  "request_id" : "13760c1fe8655e61209b75665e9bef43"
}

Status Codes

Status Code

Description

200

OK

403

Forbidden

Error Codes

See Error Codes.