Updated on 2025-02-25 GMT+08:00

Importing Resource Packages

Function

This API is used to import resource packages.

URI

POST /v1/{project_id}/resource-package/api-import

Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

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

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Workspace-Id

Yes

String

Workspace ID. For how to obtain it, see Obtaining a Workspace ID.

X-Auth-Token

Yes

String

User token.

Content-Type

Yes

String

Request body type and character set, which have fixed values.

Table 3 FormData parameters

Parameter

Mandatory

Type

Description

file

Yes

File

Resource package file.

import_strategy

Yes

String

Import strategy. The options are replace and addNew.

replace_rule

No

String

Replacement rule. The default value is BY_ID. The options are BY_ID and BY_NAME.

Enumerated values:

  • BY_ID
  • BY_NAME

Response Parameters

Table 4 Response body parameter

Parameter

Type

Description

task_id

String

Task ID.

Example Request

Import a resource package.

POST https://{endpoint}/v1/{project_id}/resource-package/api-import
{
    "file": File stream,
    "import_strategy": "replace",
    "replace_rule": "BY_ID"
}

Example Response

The resource package is successfully imported.

{
  "task_id" : "b8913c92-xxxx-4721-b8fd-a72af3945b61"
}

Status Codes

Table 5

Status Code

Description

200

The resource package is successfully imported.

Error Codes

See Error Codes.