Skip to main content
Resource Center/Resource Pool/Image Operations
POSTImage OperationsSince 0.6SynchronousAuth Required

AddImage

AddImage

Execution Availability

Try It Out

Submit a mock request using the current auth context and example-driven inputs.

Request Inputs

Body Fields

  • paramsObjectRequired

    Request body parameter object.

    • nameStringRequired

      The image name.

    • descriptionString

      Optional. The detailed description of the image.

    • urlStringRequired

      The URL of the image to be added.

    • mediaTypeString

      Optional. The image type.

    • guestOsTypeString

      Optional. The operating system type of the guest VM instance that corresponds to the image.

    • systemboolean

      Optional. Whether the image is a system image, for example, vRouter image.

    • formatString

      Optional. The image format, for example, raw.

    • platformString

      Optional. The system platform of the image.

    • backupStorageUuidsListRequired

      The UUID list of the backup storages on which the image is to be added.

    • typeString

      Optional. The reserved field for internal use.

    • resourceUuidString

      Optional. The resource UUID. If specified, the image will use the specified value as UUID.

    • architectureString

      Optional.

    • tagUuidsList

      Optional. The tag UUIDs.

  • systemTagsList

    Optional. The system tags.

  • userTagsList

    Optional. The user tags.

Responses

200 OK

On success, this API returns the following response structure.

  • successbooleanRequired

    操作是否成功。

  • errorErrorCodeRequired

    The error code. If not null, the operation fails, or vice versa. For more information, see error.

    • codeStringRequired

      The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.

    • descriptionStringRequired

      The brief description of the error.

    • detailsStringRequired

      The details about the error.

    • elaborationStringRequired

      The reserved field. Default value: null.

    • opaqueLinkedHashMapRequired

      The reserved field. Default value: null.

    • causeErrorCodeRequired

      The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.

  • inventoryImageInventoryRequired

    See inventory.

    • uuidStringRequired

      The resource UUID.

    • nameStringRequired

      The resource name.

    • descriptionStringRequired

      The detailed description of the resource.

    • stateStringRequired

      The state of the image.

    • statusStringRequired

      The status of the image.

    • sizeLongRequired

      The image size.

    • actualSizeLongRequired

      The actual size of the image.

    • md5SumStringRequired

      The MD5 checksum of the image.

    • urlStringRequired

      The URL of the image.

    • mediaTypeStringRequired

      The image type.

    • guestOsTypeStringRequired

      The guest operating system type of the image.

    • typeStringRequired

      The reserved field.

    • platformStringRequired

      The system platform of the image.

    • architectureStringRequired

      The image architecture.

    • formatStringRequired

      The image format, for example, raw.

    • systemBooleanRequired

      Whether the image is a system image.

    • virtioBooleanRequired

      Whether virtio is supported or not.

    • createDateTimestampRequired

      The creation date.

    • lastOpDateTimestampRequired

      The last operation date.

    • backupStorageRefsListRequired

      See backupStorageRefs.

      • imageUuidStringRequired

        The image UUID.

      • backupStorageUuidStringRequired

        The backup storage UUID.

      • installPathStringRequired

        在镜像服务器上的安装路径

      • exportUrlStringRequired

        导出镜像的url

      • exportMd5SumStringRequired

        导出镜像的md5值

      • statusStringRequired

        镜像就绪状态

      • createDateTimestampRequired

        The creation date.

      • lastOpDateTimestampRequired

        The last operation date.

Endpoint

POST/zstack/v1/images

/zstack/v1/images

Operation ID

AddImage

Permalink

Request Example

curl -X POST 'http://{host}/zstack/v1/images' -H 'Authorization: OAuth {sessionUuid}' -H 'Content-Type: application/json;charset=UTF-8' -d '{"params":{"name":"<name>","description":"<description>","url":"<url>","mediaType":"<mediaType>","guestOsType":"<guestOsType>","system":true,"format":"<format>","platform":"<platform>","backupStorageUuids":["<backupStorageUuids>"],"type":"<type>","resourceUuid":"<resourceUuid>","architecture":"<architecture>","tagUuids":["<tagUuids>"]},"systemTags":["<systemTags>"],"userTags":["<userTags>"]}'

Response Example

200
{ "inventory": { "uuid": "1eb26d06364036b7860d2b7dbb462b8c", "name": "TinyLinux", "url": "http://192.168.1.20/share/images/tinylinux.qcow2", "mediaType": "RootVolumeTemplate", "platform": "Linux", "architecture": "x86_64", "format": "qcow2", "backupStorageRefs": [ { "id": 0.0, "imageUuid": "1eb26d06364036b7860d2b7dbb462b8c", "backupStorageUuid": "902dcc8d1015318fb4903df890765c4d", "installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd", "status": "Ready" } ] } }

Change History

This API has no change history records yet.

View all change history