Importing Configurations
Function
This API is used to import configurations to the configuration management center.
This API applies to ServiceComb engine 2.x.
URL
POST /v1/{project_id}/kie/file
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant sub-project ID, which must be unique. The value contains 1 to 64 characters. See Obtaining a Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
override |
Yes |
String |
force: Forcible import will overwrite duplicate items. skip: Duplicate items will be skipped. abort: If duplicate items are found, the import stops. |
label |
No |
String |
To import a specified label, enter a value in the format of {Label key}:{Label value}. If this parameter is empty, the label of the body is imported. |
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. |
x-engine-id |
Yes |
String |
ID of the engine whose configuration is to be uploaded. See Querying the Microservice Engine List. |
X-Enterprise-Project-ID |
No |
String |
Enterprise project ID. If this parameter is not set, the default enterprise project is default and the ID is 0. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
upload_file |
Yes |
File |
File to be imported. The file name format is fileName.json. File format: { "data": [ { "key": "keyItem1", "value": "valueItem1", "labels":{ "1": "1" }, "status": "enabled", "value_type": "text" } ] } |
Response
Status code: 200
Parameter |
Type |
Description |
---|---|---|
success |
List<KVDoc> |
List of configuration items that are successfully imported. |
failure |
List<DocFailedOfUpload> |
List of configuration items that fail to be imported. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Configuration ID. |
key |
String |
Configuration key. |
value |
String |
Configuration value. |
value_type |
String |
Type of the configuration value. |
status |
String |
Configuration status. |
create_time |
Integer |
Time when the configuration is created. |
update_time |
Integer |
Time when the configuration is updated. |
create_revision |
Integer |
Version number of the created configuration. |
update_revision |
Integer |
Version number of the updated configuration. |
labels |
Map<String,String> |
Configuration labels. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Key of the configuration item that fails to be imported. |
labels |
Map<String,String> |
Labels of the configuration item that fails to be imported. |
error_code |
String |
Error code. |
error_message |
String |
Error message. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_message |
String |
Error message. |
detail |
String |
Location details. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_message |
String |
Error message. |
detail |
String |
Location details. |
Example Request
Import a configuration file. If the same configurations exist, these configurations will be overwritten based on the body label.
POST https://{endpoint}/v1/{project_id}/kie/file/override=force ----WebKitFormBoundary7MA4YWxkTrZu0gW Content-Disposition: form-data; name="upload_file"; filename="custom_1663124521493.json" Content-Type: application/json ----WebKitFormBoundary7MA4YWxkTrZu0gW
Example Response
Successfully queried.
{ "success": [ { "id": "7e2d346e-d907-4871-bf51-a17fc7e52ad4", "key": "2", "value": "2", "value_type": "text", "create_revision": 3, "update_revision": 3, "status": "enabled", "create_time": 1636374809, "update_time": 1636374809, "labels": { "2": "2", "environment": "production" } }, { "id": "907b3891-c691-4ae0-816f-e91eba705e28", "key": "1", "value": "1", "value_type": "text", "create_revision": 4, "update_revision": 4, "status": "enabled", "create_time": 1636374809, "update_time": 1636374809, "labels": { "1": "1", "environment": "production" } } ], "failure": [] }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
500 |
Internal Server Error |
Error Code
See CSE Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot