Updated on 2024-12-16 GMT+08:00

Importing a Configuration File

Function

This API is used to import a configuration file in .zip format.

URI

POST /v3/{project_id}/cas/configs/import

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Tenant's project ID. See Obtaining a Project ID.

Request

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type or format:

multipart/form-data

X-Auth-Token

Yes

String

API calling can be authenticated using a token or AK/SK. If you use a token, this parameter is mandatory and must be set to the token. For details about how to obtain the token, see Authentication.

Table 3 Request body parameter

Parameter

Mandatory

Type

Description

upload_file

Yes

File

The configuration file to be imported must be compressed into a .zip package, and the package size cannot exceed 500 KB.

The package to be imported can contain up to 500 configuration files.

The folder name in the compressed package is the configuration group name, and the file name is the configuration name. The file can be in the YAML or properties format.

repetition_policy

No

String

Policy for processing the configuration file with the same name as the imported configuration file:

  • covered: Replace the existing configuration file with the imported configuration file.
  • skip: Skip the import of the configuration file with the same name.

Response

Table 4 Response parameters

Parameter

Type

Description

covered_num

Integer

Number of configuration files that are overwritten.

skip_num

Integer

Number of configuration files that are skipped during file import.

total_num

Integer

Number of configuration files that are imported.

Example Request

POST https://{endpoint}/v3/{project_id}/cas/configs/import
{repetition_policy=covered }

Example Response

{
	"covered_num" : 0,
	"total_num" : 1
}

Status Code

Status Code

Description

204

OK

400

Bad Request

404

Not Found

500

Internal Server Error

Error Code

The error code format is SVCSTG.00100.[Error_ID], for example, SVCSTG.00100400. For details, see ServiceStage Error Codes.