Data center
2.7.1 Get data center details
API endpoint
GET /NSphere/api/hostpool-resource
API description
One of id and hostpoolName is required. If both are provided, id takes precedence.
Request Content-Type
application/x-www-form-urlencoded
Response Content-Type
application/json
Request parameters
Parameter name | Description | Location | Required | Type | schema |
id | Data center ID. | query | false | integer(int64) | |
hostpoolName | Data center name. (Deprecated; use | query | false | string | |
title | Data center name. | query | false | string |
Response status
Response code | Description | schema |
200 | OK | ApiResponseApiGetHostpoolDetailVO |
Response parameters
Parameter name | Description | Type | schema |
state | Status code. 0: success, 1: failure, 2: partial success. | integer(int32) | integer(int32) |
errorCode | Error code. A non-zero value indicates a business error. | integer(int32) | integer(int32) |
successMessage | Success message. | string | |
failureMessage | Error message. Valid when the result is failure or partial success. | string | |
data | Response data. When the status code is 0 this contains the normal returned data; when non-zero and non-empty it contains the data required to describe the exception. | ApiGetHostpoolDetailVO | ApiGetHostpoolDetailVO |
summary | ApiGetHostpoolSummaryVO | ApiGetHostpoolSummaryVO | |
hostNum | Number of hosts. | string | |
cpuNum | Total CPU cores. | string | |
memTotal | Total memory. | string | |
storageTotal | Total local storage. | string | |
avaiStorageTotal | Total local available storage. | string | |
domainNum | Number of VMs. | string | |
runDomainNum | Number of running VMs. | string | |
shutoffDomainNum | Number of powered-off VMs. | string | |
memSuperRatio | Memory allocation ratio (%). | string | |
cpuSuperRatio | CPU allocation ratio (%). | string | |
storageSuperRatio | Shared storage allocation ratio (%). | string | |
cpuUsed | CPU utilization (%). | string | |
memoryUsed | Memory utilization (%). | string | |
storageUsed | Storage utilization (%). | string | |
clusterNum | Number of clusters. | string | |
domainDensity | VM density. | string | |
info | ApiGetHostpoolVO | ApiGetHostpoolVO | |
id | Data center ID. | integer(int64) | |
name | Data center name. (Deprecated; use | string | |
title | Data center display name. | string | |
operatorGroupId | Operator group ID. | integer(int64) | |
operatorGroupCode | Operator group code. | string | |
publicCloudId | External cloud resource ID. | integer(int64) | |
storageIp | Storage network IP. | string | |
storageMask | Storage network mask. | string | |
childNum | Number of direct children of the data center — the number of hosts and clusters directly beneath it. | integer(int32) |
Response example
{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {
"summary": {
"hostNum": null,
"cpuNum": null,
"memTotal": null,
"storageTotal": null,
"avaiStorageTotal": null,
"domainNum": null,
"runDomainNum": null,
"shutoffDomainNum": null,
"memSuperRatio": null,
"cpuSuperRatio": null,
"storageSuperRatio": null,
"cpuUsed": null,
"memoryUsed": null,
"storageUsed": null,
"clusterNum": null,
"domainDensity": null
},
"info": {
"id": null,
"name": null,
"title": null,
"operatorGroupId": null,
"operatorGroupCode": null,
"publicCloudId": null,
"storageIp": null,
"storageMask": null,
"childNum": null
}
}
}
2.7.2 Add a data center
API endpoint
POST /NSphere/api/hostpool-resource
API description
On success, the response data is the ID of the newly added data center.
Request Content-Type
application/json
Response Content-Type
application/json
Request example
{
"title": ""
}
Request parameters
Parameter name | Description | Location | Required | Type | schema |
apiAddHostpoolDTO | ApiAddHostpoolDTO | body | true | ApiAddHostpoolDTO | ApiAddHostpoolDTO |
title | Data center name. Minimum length 1, maximum length 32. Only Chinese characters, letters, digits, minus signs, underscores, and dots are allowed. The first character cannot be a minus sign or a dot, and the value cannot consist entirely of digits. | true | string |
Response status
Response code | Description | schema |
200 | OK | ApiResponseLong |
Response parameters
Parameter name | Description | Type | schema |
state | Status code. 0: success, 1: failure, 2: partial success. | integer(int32) | integer(int32) |
errorCode | Error code. A non-zero value indicates a business error. | integer(int32) | integer(int32) |
successMessage | Success message. | string | |
failureMessage | Error message. Valid when the result is failure or partial success. | string | |
data | Response data. When the status code is 0 this contains the normal returned data; when non-zero and non-empty it contains the data required to describe the exception. | integer(int64) | integer(int64) |
Response example
{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": null
}
2.7.3 Edit a data center
API endpoint
PUT /NSphere/api/hostpool-resource/{id}
API description
Request Content-Type
application/json
Response Content-Type
application/json
Request example
{
"title": ""
}
Request parameters
Parameter name | Description | Location | Required | Type | schema |
id | Data center ID. | path | true | integer(int64) | |
apiModifyHostpoolDTO | ApiModifyHostpoolDTO | body | true | ApiModifyHostpoolDTO | ApiModifyHostpoolDTO |
title | Data center name. Maximum length 32. Only Chinese characters, letters, digits, minus signs, underscores, and dots are allowed. The first character cannot be a minus sign or a dot, and the value cannot consist entirely of digits. | true | string |
Response status
Response code | Description | schema |
200 | OK | ApiResponseVoid |
Response parameters
Parameter name | Description | Type | schema |
state | Status code. 0: success, 1: failure, 2: partial success. | integer(int32) | integer(int32) |
errorCode | Error code. A non-zero value indicates a business error. | integer(int32) | integer(int32) |
successMessage | Success message. | string | |
failureMessage | Error message. Valid when the result is failure or partial success. | string | |
data | Response data. When the status code is 0 this contains the normal returned data; when non-zero and non-empty it contains the data required to describe the exception. | string |
Response example
{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}
2.7.4 Delete a data center
API endpoint
DELETE /NSphere/api/hostpool-resource/{id}
API description
Request Content-Type
application/x-www-form-urlencoded
Response Content-Type
application/json
Request parameters
Parameter name | Description | Location | Required | Type | schema |
id | Data center ID. | path | true | integer(int64) |
Response status
Response code | Description | schema |
200 | OK | ApiResponseVoid |
Response parameters
Parameter name | Description | Type | schema |
state | Status code. 0: success, 1: failure, 2: partial success. | integer(int32) | integer(int32) |
errorCode | Error code. A non-zero value indicates a business error. | integer(int32) | integer(int32) |
successMessage | Success message. | string | |
failureMessage | Error message. Valid when the result is failure or partial success. | string | |
data | Response data. When the status code is 0 this contains the normal returned data; when non-zero and non-empty it contains the data required to describe the exception. | string |
Response example
{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": {}
}
2.7.5 List data centers
API endpoint
GET /NSphere/api/hostpool-resource/list
API description
Request Content-Type
application/x-www-form-urlencoded
Response Content-Type
application/json
Request parameters
Parameter name | Description | Location | Required | Type | schema |
ids | List of data center IDs. When omitted, all data centers are returned. | query | false | array | integer |
Response status
Response code | Description | schema |
200 | OK | ApiResponseListApiGetHostpoolVO |
Response parameters
Parameter name | Description | Type | schema |
state | Status code. 0: success, 1: failure, 2: partial success. | integer(int32) | integer(int32) |
errorCode | Error code. A non-zero value indicates a business error. | integer(int32) | integer(int32) |
successMessage | Success message. | string | |
failureMessage | Error message. Valid when the result is failure or partial success. | string | |
data | Response data. When the status code is 0 this contains the normal returned data; when non-zero and non-empty it contains the data required to describe the exception. | array | ApiGetHostpoolVO |
id | Data center ID. | integer(int64) | |
name | Data center name. (Deprecated; use | string | |
title | Data center display name. | string | |
operatorGroupId | Operator group ID. | integer(int64) | |
operatorGroupCode | Operator group code. | string | |
publicCloudId | External cloud resource ID. | integer(int64) | |
storageIp | Storage network IP. | string | |
storageMask | Storage network mask. | string | |
childNum | Number of direct children of the data center — the number of hosts and clusters directly beneath it. | integer(int32) |
Response example
{
"state": 0,
"errorCode": 0,
"successMessage": null,
"failureMessage": null,
"data": [
{
"id": null,
"name": null,
"title": null,
"operatorGroupId": null,
"operatorGroupCode": null,
"publicCloudId": null,
"storageIp": null,
"storageMask": null,
"childNum": null
}
]
}