Description
Adds host type information.
Call instructions
Interface constraints
The caller must have the HOST_MANAGER permission.
Request path
POST /api/v2/compute/hostTypes
Request parameters
body:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| name | String | Yes | small | Host type name. |
| description | String | No | 2core 16gb | Host type description information. |
Return result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The requested data. |
| ├─ contents | Array | An array of HostType objects. For more information, see HostType data structure. |
| ├─ page | Object | Paging information. For more information, see page data structure. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time taken by the server to process the request (in milliseconds). |
| status | Integer | An HTTP status code that conforms to the HTTP status specification. |
| traceId | String | The Trace ID of the request, which is used for troubleshooting. |
| server | String | The address of the application service that responded to the request. |
HostType data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Long | Host type ID. |
| name | String | Host type name. |
| description | String | Host type description information. |
| createTime | String | Host type creation time. |
| updateTime | String | Host type modification time. |
page data structure
Parameter |
Type |
Description |
|---|---|---|
| totalElements | Integer | Total number of records. |
| totalPages | Integer | Total number of pages. |
| number | Integer | Current page number. |
| size | Integer | The size of the current page. |
Examples
Request example
POST /api/v2/compute/hostTypes' -H 'Content-Type: application/json' --data-raw '{"name":"tiny","description":"2core 16gb"}'
Return example
{
"data": {
"contents": [
{
"createTime": "2024-12-31T18:01:34+08:00",
"description": null,
"id": 1,
"name": "ECS_8C64G",
"updateTime": "2024-12-31T18:01:34+08:00"
}
],
"page": {
"number": 1,
"size": 5000,
"totalElements": 1,
"totalPages": 1
}
},
"duration": 5823,
"server": "b3b6d90167",
"status": 200,
"successful": true,
"timestamp": "2025-04-27T11:01:59.503+08:00",
"traceId": "4ebe74db34f22716"
}
