Image Related Interface
Create a Custom Image
- This API is used to create a custom image, whose quota is 20 per account number by default. The created image can be used to reload the instance.
- The custom image can be created successfully only when the instance is in the Running or Stopped status. Otherwise, it prompts an error 409.
Request Structure
POST /v{version}/image?clientToken={clientToken} HTTP/1.1
Host: bbc.bj.baidubce.com
Authorization: authorization string
{
"imageName" : imageName,
"instanceId" : instanceId
}
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | String | Yes | URI parameter | API version number |
clientToken | String | Yes | Query parameter | Means the idempotence Token, which is an ASCII string with a length not exceeding 64 bits. |
imageName | String | Yes | Request Body Parameter | The name of custom image to create can not be empty, with a length of 1-65 characters. It can only contain letters, numbers and strike. |
instanceId | String | No | Request Body Parameter | This parameter refers to the instance ID to create the mirror during the creation of mirror from the instance. |
Return Header Field
There are no other special header fields except the common header field.
Return Parameter
Parameter Name | Type | Description |
---|---|---|
imageId | String | Image ID created |
Error Code
Error Code | Error Description | HTTP Status Code | Explanation |
---|---|---|---|
Image.ImageNameInvalid | Image name is invalid. | 400 | The image name is invalid. |
Image.ImageIdIsEmpty | Image ID cannot be empty | 400 | The image ID can not be empty. |
Image.ImageQuotaExceedLimit | Image number exceeds the limit. | 413 | The number of images exceeds the limit. |
Image.InstanceStatusForbidden | Instance not in running or stopped status. | 409 | The instance is not in Running or Stopped status. Confirm and retry. |
Request Example
POST /v1/image?clientToken=1849ef6b-f73c-4f5d-b88b-259ca47af849 HTTP/1.1
Host: bbc.bj.baidubce.com
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
{
"imageName" : "template_example_001",
"instanceId":"i-1849ef6b"
}
Return Example
HTTP/1.1 200 OK
x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
Date: Wed, 03 Dec 2014 06:42:19 GMT
Content-Type: application/json;charset=UTF-8
Server: BWS
{
"imageId" : "m-nky7qeom"
}
Query a Image List
- This API is used to query all image information of users.
- The queried image information includes system image, custom image and service integration image.
- It supports the filter query by imageType. This parameter is not required, and it is All by default, i.e., query all types of images.
Request Structure
GET /v{version}/image?marker={marker}&maxKeys={maxKeys}&imageType={imageType} HTTP/1.1
Host: bbc.bj.baidubce.com
Authorization: authorization string
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | String | Yes | URI parameter | API version number |
marker | String | No | Query parameter | The start position of query to obtain the list by batch, which is a character string generated by the system. |
maxKeys | int | No | Query parameter | It is the maximum number contained in each page, which usually does not exceed 1,000. The default value is 1000. |
imageType | String | No | Query parameter | It specifies what type of image to query, including All, System (system image/public image), Custom (custom image), Integration (service integration image), and the default value is All. |
Return Header Field
Other special header fields are not available, except for common header fields.
Return a parameter
Parameter Name | Type | Description |
---|---|---|
marker | String | Mark the starting position of the query |
isTruncated | boolean | True means there is still data behind, and false means it is already the last page. |
nextMarker | String | Get the marker value to be passed on the next page. This field does not display when “isTruncated” is false. |
maxKeys | int | Maximum number of master instances per page |
images | List<ImageModel> | Image list returned |
Request Example
GET /v1/image?marker=m-nky7qeom&maxKeys=1 HTTP/1.1
Host: bbc.bj.baidubce.com
ContentType: application/json
Date: Wed, 01 Mar 2006 12:00:00 GMT
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Return Example
HTTP/1.1 200 OK
x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
Date: Wed, 03 Dec 2014 06:42:19 GMT
Content-Type: application/json;charset=UTF-8
Server: BWS
{
"maxKeys":1,
"marker":"m-nky7qeom",
"isTruncated":true,
"nextMarker":"m-I88RTNWG",
"images":[
{
"id": "m-nky7qeom",
"createTime": "2015-06-17T10:37:02Z",
"name": "ubuntu-14.04.1-server-amd64-201506171832",
"type": "System",
"osType": "linux",
"osVersion": "14.04.1 LTS",
"osName": "Ubuntu",
"osBuild": "2015061700",
"osArch": "x86_64 (64bit)",
"status": "Available",
"desc": null
}
]
}
Query Image Details
- This API is used to query the single image details through the specified image ID.
Request Structure
GET /v{version}/image/{imageId} HTTP/1.1
Host: bbc.bj.baidubce.com
Authorization: authorization string
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | String | Yes | URI parameter | API version number |
imageId | String | Yes | URI parameter | Image ID to query |
Return Header Field
There are no other special header fields except the common header field.
Return Parameter
Parameter Name | Type | Description |
---|---|---|
id | String | Image ID |
name | String | Image name |
type | ImageType | Image type |
osType | String | Operating system type |
osVersion | String | Operating system version |
osArch | String | Operating system bits |
osName | String | Operating system name |
osBuild | String | Build time of image operating system |
createTime | String | Image creation time, which conforms to the BCE date format |
status | ImageStatus | Image status |
desc | String | Image description information |
Request Example
GET /v1/image/m-nky7qeom HTTP/1.1
Host: bbc.bj.baidubce.com
ContentType: application/json
Date: Wed, 01 Mar 2006 12:00:00 GMT
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Return Example
HTTP/1.1 200 OK
x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
Date: Wed, 03 Dec 2014 06:42:19 GMT
Content-Type: application/json;charset=UTF-8
Server: BWS
{
"id": "m-nky7qeom",
"createTime": "2015-06-17T10:37:02Z",
"name": "ubuntu-14.04.1-server-amd64-201506171832",
"type": "System",
"osType": "linux",
"osVersion": "14.04.1 LTS",
"osName": "Ubuntu",
"osBuild": "2015061700",
"osArch": "x86_64 (64bit)",
"status": "Available",
"desc": null
}
Delete a Custom Image
- This API is used to delete the custom image, which is only limited to the custom image. The system image and service integration image can not be deleted.
- The image specified by imageId does not exist, and it prompts an error 404.
- The deleted image can not be recovered or used to create or reset the instance:
Request Structure
DELETE /v{version}/image/{imageId} HTTP/1.1
Host: bbc.bj.baidubce.com
Authorization: authorization string
Request Header Field
There are no other special header fields except the public header field.
Request Parameter
Parameter Name | Type | Required | Parameter Position | Description |
---|---|---|---|---|
version | String | Yes | URI parameter | API version number |
imageId | String | Yes | URI parameter | Image ID to delete |
Return Header Field
There are no other special header fields except the common header field.
Return Parameter
No special return parameters are available.
Error Code
Error Code | Error Description | HTTP status code | Explanation |
---|---|---|---|
Image.UnCustomImageCannotBeDeleted | Only custom image can be deleted. | 403 | The non-custom image can not be deleted. |
Image.CreatingImageCannotBeDeleted | Cannot delete image when creating. | 409 | The creating image can not be deleted. |
Request Example
DELETE /v1/image/m-nky7qeom HTTP/1.1
Host: bbc.bj.baidubce.com
ContentType: application/json
Date: Wed, 01 Mar 2006 12:00:00 GMT
Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
Return Example
HTTP/1.1 200 OK
x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
Date: Wed, 03 Dec 2014 06:42:19 GMT
Content-Type: application/json;charset=UTF-8
Server: BWS