• Image Management Service

ims
  1. Help Center
  2. Image Management Service
  3. API Reference
  4. APIs
  5. Image (Extension APIs)
  6. Querying Images

Querying Images

Function

This API is used to query images using search criteria and to display the images in a list.

URI

URI format

GET /v2/cloudimages

NOTE:

You can type a question mark (?) and an ampersand (&) at the end of the URI to define multiple search criteria. For details, see the example request.

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Type

Description

__isregistered

No

String

Specifies whether the image is available. Set the value to true. The value is true for all extension APIs by default. Common users can query only the images for which the value of this parameter is true.

__imagetype

No

String

Specifies the image type. The following types are supported:

  • Public image: The value is gold.
  • Private image: The value is private.
  • Shared image: The value is shared.

protected

No

Boolean

Specifies whether the image is protected. The value can be true or false. Set it to true when you query public images. This parameter is optional when you query private images.

visibility

No

String

Specifies whether the image can be seen by other tenants. The value can be private, public, or shared.

owner

No

String

Specifies the image owner.

id

No

String

Specifies the image ID.

status

No

String

Specifies the image status. The value can be one of the following:

  • queued: indicates that the image metadata has already been created, and it is ready for the image file to upload.
  • saving: indicates that the image file is being uploaded to the backend storage.
  • deleted: indicates that the image has been deleted.
  • killed: indicates that an error occurs on the image uploading.
  • active: indicates that the image is available for use.

name

No

String

Specifies the image name. For detailed description, see Image Attributes.

container_format

No

String

Specifies the container type. The value is bare.

disk_format

No

String

Specifies the image format. The value can be vhd, raw, zvhd, or qcow2. The default value is zvhd2.

min_ram

No

Int

Specifies the minimum memory size (MB) required for running the image. The parameter value depends on the ECS specifications limit. The value is generally set to 0.

min_disk

No

Int

Specifies the minimum disk space (GB) required for running the image. The value ranges from 1 GB to 1024 GB.

__os_bit

No

String

Specifies the OS architecture, 32 bit or 64 bit.

__platform

No

String

Specifies the image platform type. The value can be Windows, Ubuntu, RedHat, SUSE, CentOS, Debian, OpenSUSE, Oracle Linux, Fedora, Other, CoreOS, or EulerOS.

marker

No

String

Specifies the start number from which images are queried. The value is the image ID.

limit

No

Int

Specifies the number of images to be queried. The value is an integer and is 500 by default.

sort_key

No

String

Specifies the field for sorting the query results. The value can be an attribute of the image: name, container_format, disk_format, status, id, or size. The default value is created_at.

sort_dir

No

String

Specifies whether the query results are sorted in ascending or descending order. Its value can be desc (default) or asc. This parameter is used together with parameter sort_key. The default value is desc.

__os_type

No

String

Indicates the image OS type. The value can be Linux, Windows, or Other.

tag

No

String

Adds a tag to an image. Tags can be used as a filter to query images.

NOTE:

The tagging function has been upgraded. If the tags added before the function upgrade are in the format of "Key.Value", query tags using "Key=Value". For example, an existing tag is a.b. After the tag function upgrade, query the tag using "tag=a=b".

member_status

No

String

Specifies the member status. The value can be accepted, rejected, or pending.

  • accepted: indicates that the shared image is accepted.
  • rejected indicates that the image shared by others is rejected.
  • pending indicates that the image shared by others needs to be confirmed.

To use this parameter, set visibility to shared during the query.

__support_kvm

No

String

Specifies whether the image supports KVM. If yes, the value is true. Otherwise, this attribute is not required.

__support_xen

No

String

Specifies whether the image supports Xen. If yes, the value is true. Otherwise, this attribute is not required.

__support_largememory

No

String

Specifies whether the image supports large-memory ECSs. If the image supports large-memory ECSs, the value is true. Otherwise, this attribute is not required. For the supported OSs, see Table 3.

__support_diskintensive

No

String

Specifies whether the image supports disk-intensive ECSs. If the image supports disk-intensive ECSs, the value is true. Otherwise, this attribute is not required. For the supported OSs, see Table 3.

__support_highperformance

No

String

Specifies whether the image supports high-performance ECSs. If the image supports high-performance ECSs, the value is true. Otherwise, this attribute is not required. For the supported OSs, see Table 3.

__support_xen_gpu_type

No

String

The image supports GPU-optimized ECSs on the Xen platform. See Table 2 for its value. For the supported OSs, see Table 3. If the image does not support GPU-optimized ECSs on the Xen platform, this attribute is not required. This attribute cannot co-exist with __support_xen and __support_kvm.

__support_kvm_gpu_type

No

String

Specifies whether the image supports GPU-optimized ECSs on the KVM platform. See Table 2 for its value. If the image does not support GPU-optimized ECSs on the KVM platform, this attribute is not required. This attribute cannot co-exist with __support_xen and __support_kvm.

__support_xen_hana

No

String

Specifies whether the image supports HANA ECSs on the Xen platform. If yes, the value is true. Otherwise, this attribute is not required.

This attribute cannot co-exist with __support_xen and __support_kvm.

__support_kvm_infiniband

No

String

Specifies whether the image supports ECSs with the InfiniBand NIC on the KVM platform. If yes, the value is true. Otherwise, this attribute is not required.

This attribute cannot co-exist with __support_xen.

virtual_env_type

No

String

Specifies the environment where the image is used. The value can be FusionCompute, Ironic, or DataImage.

  • For an ECS image, set the value to FusionCompute.
  • For a data disk image, set the value to DataImage.
  • For a BMS image, set the value to Ironic.

created_at

No

String

Specifies the time when the image was created. Images can be queried by time. The value is in the format of Operator:UTC time.

The following operators are supported:

  • gt: greater than
  • gte: greater than or equal to
  • lt: less than
  • lte: less than or equal to
  • eq: equal to
  • neq: not equal to

The time format is yyyy-MM-ddThh:mm:ssZ or yyyy-MM-dd hh:mm:ss.

For example, to query images whose creation time is earlier than Oct 28, 2018 10:00:00, set the value of created_at to gt:2018-10-28T10:00:00Z.

updated_at

No

String

Specifies the time when the image was modified. Images can be queried by time. The value is in the format of Operator:UTC time.

The following operators are supported:

  • gt: greater than
  • gte: greater than or equal to
  • lt: less than
  • lte: less than or equal to
  • eq: equal to
  • neq: not equal to

The time format is yyyy-MM-ddThh:mm:ssZ or yyyy-MM-dd hh:mm:ss.

For example, to query images whose modification time is earlier than Oct 28, 2018 10:00:00, set the value of created_at to gt:2018-10-28T10:00:00Z.

Request

Example request
GET /v2/cloudimages?__imagetype=gold&sort_key=name&limit=1

Response

  • Response parameters
    Table 2 Parameter description

    Name

    Type

    Description

    file

    String

    Specifies the URL for uploading and downloading the image file.

    owner

    String

    Specifies the image owner.

    id

    String

    Specifies the image ID.

    size

    Long

    This parameter is unavailable currently.

    self

    String

    Specifies the image URL.

    schema

    String

    Specifies the image schema.

    status

    String

    Specifies the image status. The value can be one of the following:

    • queued: indicates that the image metadata has already been created, and it is ready for the image file to upload.
    • saving: indicates that the image file is being uploaded to the backend storage.
    • deleted: indicates that the image has been deleted.
    • killed: indicates that an error occurs on the image uploading.
    • active: indicates that the image is available for use.

    tags

    List<String>

    Lists the image tags, through which you can manage private images in your own way. You can use the image tag API to add different tags to each image and filter images by tag.

    visibility

    String

    Specifies whether the image can be seen by other tenants. The value can be private, public, or shared.

    name

    String

    Specifies the image name. For detailed description, see Image Attributes.

    checksum

    String

    This parameter is unavailable currently.

    deleted

    Boolean

    Specifies whether the image has been deleted. The value can be true or false.

    protected

    Boolean

    Specifies whether the image is protected. A protected image cannot be deleted. The value can be true or false.

    container_format

    String

    Specifies the container type.

    min_ram

    Int

    Specifies the minimum memory size (MB) required for running the image. The parameter value depends on the ECS specifications limit. The value is generally set to 0.

    max_ram

    String

    Specifies the maximum memory of the image in the unit of MB. The parameter value depends on the ECS flavor and is generally not configured.

    updated_at

    String

    Specifies the time when the image was updated. The value is in UTC format.

    __os_bit

    String

    Specifies the OS architecture: 32 or 64.

    __os_version

    String

    Specifies the OS version.

    __description

    String

    Provides supplementary information about the image. For detailed description, see Image Attributes.

    disk_format

    String

    Specifies the image format. The value can be vhd, raw, zvhd, or qcow2. The default value is vhd.

    __isregistered

    String

    Specifies whether the image has been registered. The value can be true or false.

    __platform

    String

    Specifies the image platform type. The value can be Windows, Ubuntu, RedHat, SUSE, CentOS, Debian, OpenSUSE, Oracle Linux, Fedora, Other, CoreOS, or EulerOS.

    __os_type

    String

    Specifies the operating system type. The value can be Linux, Windows, or Other.

    min_disk

    Int

    Specifies the minimum disk space (GB) required for running the image. The value ranges from 1 GB to 1024 GB.

    virtual_env_type

    String

    Specifies the environment where the image is used. The value can be FusionCompute, Ironic, or DataImage.

    • For an ECS image, set the value to FusionCompute.
    • For a data disk image, set the value to DataImage.
    • For a BMS image, set the value to Ironic.

    __image_source_type

    String

    Specifies the image backend storage type. Only UDS is supported currently.

    __imagetype

    String

    Specifies the image type. The following types are supported:

    • Public image: The value is gold.
    • Private image: The value is private.
    • Shared image: The value is shared.

    created_at

    String

    Specifies the time when the image was created. The value is in UTC format.

    virtual_size

    Int

    This parameter is unavailable currently.

    deleted_at

    String

    Specifies the time when the image was deleted. The value is in UTC format.

    __originalimagename

    String

    Specifies the parent image ID.

    If the image is a public image or created from an image file, this value is left empty.

    __backup_id

    String

    Specifies the backup ID. To create an image using a backup, set the value to the backup ID. Otherwise, this value is left empty.

    __productcode

    String

    Specifies the ID of the market image product.

    __image_size

    String

    Specifies the size (bytes) of the image file.

    __data_origin

    String

    Specifies the image resource.

    If the image is a public image, this parameter is left empty.

    __support_kvm

    String

    Specifies whether the image supports KVM. If yes, the value is true. Otherwise, this attribute is not required.

    __support_xen

    String

    Specifies whether the image supports Xen. If yes, the value is true. Otherwise, this attribute is not required.

    __support_largememory

    String

    Specifies whether the image supports large-memory ECSs. If the image supports large-memory ECSs, the value is true. Otherwise, this attribute is not required.

    __support_diskintensive

    String

    Specifies whether the image supports disk-intensive ECSs. If the image supports disk-intensive ECSs, the value is true. Otherwise, this attribute is not required.

    __support_highperformance

    String

    Specifies whether the image supports high-performance ECSs. If the image supports high-performance ECSs, the value is true. Otherwise, this attribute is not required.

    __support_xen_gpu_type

    String

    The image supports GPU-optimized ECSs on the Xen platform. See Table 2 for its value. For the supported OSs, see Table 3. If the image does not support GPU-optimized ECSs on the Xen platform, this attribute is not required. This attribute cannot co-exist with __support_xen and __support_kvm.

    __support_kvm_gpu_type

    String

    Specifies whether the image supports GPU-optimized ECSs on the KVM platform. See Table 2 for its value.

    If the image does not support GPU-optimized ECSs on the KVM platform, this attribute is not required. This attribute cannot co-exist with __support_xen and __support_kvm.

    __support_xen_hana

    String

    Specifies whether the image supports HANA ECSs on the Xen platform. If yes, the value is true. Otherwise, this attribute is not required.

    This attribute cannot co-exist with __support_xen and __support_kvm.

    __support_kvm_infiniband

    String

    Specifies whether the image supports ECSs with the InfiniBand NIC on the KVM platform. If yes, the value is true. Otherwise, this attribute is not required.

    This attribute cannot co-exist with __support_xen.

    __system_support_market

    Boolean

    Specifies whether an image can be published in Marketplace.

    • true: The image can be published.
    • false: The image cannot be published.

    __root_origin

    String

    Indicates that the image is created from an external image file. Example value: file

    __sequence_num

    String

    Specifies the ECS system disk slot number corresponding to the image.

    Example value: 0

  • Example response
    STATUS CODE 200
    {
      "images": [
        {
          "schema": "/v2/schemas/image",
          "min_disk": 100,
          "created_at": "2018-09-06T14:03:27Z",
          "__image_source_type": "uds",
          "container_format": "bare",
          "file": "/v2/images/bc6bed6e-ba3a-4447-afcc-449174a3eb52/file",
          "updated_at": "2018-09-06T15:17:33Z",
          "protected": true,
          "checksum": "d41d8cd98f00b204e9800998ecf8427e",
          "__support_kvm_fpga_type": "VU9P",
          "id": "bc6bed6e-ba3a-4447-afcc-449174a3eb52",
          "__isregistered": "true",
          "min_ram": 2048,
          "__lazyloading": "true",
          "owner": "1bed856811654c1cb661a6ca845ebc77",
          "__os_type": "Linux",
          "__imagetype": "gold",
          "visibility": "public",
          "virtual_env_type": "FusionCompute",
          "tags": [],
          "__platform": "CentOS",
          "size": 0,
          "__os_bit": "64",
          "__os_version": "CentOS 7.3 64bit",
          "name": "CentOS 7.3 64bit vivado",
          "self": "/v2/images/bc6bed6e-ba3a-4447-afcc-449174a3eb52",
          "disk_format": "zvhd2",
          "virtual_size": null,
          "status": "active"
        },
        {
          "schema": "/v2/schemas/image",
          "min_disk": 100,
          "created_at": "2018-09-06T14:03:05Z",
          "__image_source_type": "uds",
          "container_format": "bare",
          "file": "/v2/images/0328c25e-c840-4496-81ac-c4e01b214b1f/file",
          "updated_at": "2018-09-25T14:27:40Z",
          "protected": true,
          "checksum": "d41d8cd98f00b204e9800998ecf8427e",
          "__support_kvm_fpga_type": "VU9P_COMMON",
          "id": "0328c25e-c840-4496-81ac-c4e01b214b1f",
          "__isregistered": "true",
          "min_ram": 2048,
          "__lazyloading": "true",
          "owner": "1bed856811654c1cb661a6ca845ebc77",
          "__os_type": "Linux",
          "__imagetype": "gold",
          "visibility": "public",
          "virtual_env_type": "FusionCompute",
          "tags": [],
          "__platform": "CentOS",
          "size": 0,
          "__os_bit": "64",
          "__os_version": "CentOS 7.3 64bit",
          "name": "CentOS 7.3 64bit with sdx",
          "self": "/v2/images/0328c25e-c840-4496-81ac-c4e01b214b1f",
          "disk_format": "zvhd2",
          "virtual_size": null,
          "status": "active"
        }
      ]
    }

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error. For details about the returned error code, see Error Codes.

    401 Unauthorized

    Authentication failed.

    403 Forbidden

    You do not have the rights to perform the operation.

    404 Not Found

    The requested resource was not found.

    500 Internal Server Error

    Internal service error.

    503 Service Unavailable

    The service is unavailable.