ImageList

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
m (1 revision: Release 86)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This operation will list all available images.
+
= GET /accounts/''{accountId}''/flexcloud/images?name=''{imageName}''&status=''{imageStatus}''&type=''{imageType}''&zone=''{zoneId}'' =
 
+
Lists all images.
=='''GET''' /images==
+
__TOC__
 +
== Request ==
 +
<code>GET /accounts/''{accountId}''/flexcloud/images?name=''{imageName}''&status=''{imageStatus}''&type=''{imageType}''&zone=''{zoneId}''</code>
  
 
=== Parameters ===
 
=== Parameters ===
No parameters
+
; accountId - ''string''
 +
: The selected account Id.
 +
 
 +
; name - ''string''
 +
: ''Optional'' image name to search for.
 +
 
 +
; status - ''string''
 +
: ''Optional'' Image status to search for. Values: '''ACTIVE''', '''SAVING''', '''DELETED'''.
 +
 
 +
; type - ''string''
 +
: ''Optional'' type of the image to search for. Values: '''BASE''', '''SERVER'''.
 +
 
 +
; zone - ''string''
 +
: ''Optional'' the zone where the image is available.
 +
 
 +
== Response ==
 +
 
 +
=== Status Code ===
 +
; 200 OK
 +
: Success
 +
 
 +
; 401 Unauthorized
 +
: Failure - This server could not verify that you are authorized to access the document you requested.  Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
 +
 
 +
; 404 Not Found
 +
: Failure - The Resource does not exist
  
=== Result ===
+
=== Response Body ===
==== JSON ====
+
 
  <nowiki>
 
  <nowiki>
 
{
 
{
  "images":[
+
  "images":[
      {
+
    {
        "name":"{display_image_name}",
+
      "name":"{display_image_name}",
        "links":[
+
      "links":[
            {
+
        {"href":"</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/{image_id}/", "rel":"self"},
              "href":"http://{api_server}/images/{image_id}/",
+
        {"href":"</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/{image_id}/", "rel":"bookmark"}
              "rel":"self"
+
      ],
            },
+
      "id": "{image_id}",
            {
+
       "zones": ["{zone_id_1}", "{zone_id_2}"]
              "href":"http://{api_server}/images/{image_id}/",
+
    },
              "rel":"bookmark"
+
    {
            }
+
      "name":"{display_image_name}",
        ],
+
      "links":[
        "id":"{image_id}"
+
        {"href":"</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/{image_id}/", "rel":"self"},
       },
+
        {"href":"</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/{image_id}/", "rel":"bookmark"}
      {
+
      ],
        "name":"{display_image_name}",
+
      "id":"{image_id}",
        "links":[
+
       "zones": ["{zone_id}"]
            {
+
    }
              "href":"http://{api_server}/images/{image_id}/",
+
  ]
              "rel":"self"
+
}</nowiki>
            },
+
            {
+
              "href":"http://{api_server}/images/{image_id}/",
+
              "rel":"bookmark"
+
            }
+
        ],
+
        "id":"{image_id}"
+
       }
+
  ]
+
}
+
</nowiki>
+
  
 +
==== Parameters ====
 
; id - ''string''
 
; id - ''string''
 
: Unique identifier for this image.
 
: Unique identifier for this image.
Line 52: Line 68:
 
: Display name for this image.
 
: Display name for this image.
  
=== Response Codes ===
+
; zones - ''string''
; Success: HTTP/1.1 200 OK
+
: Zones where the image is available.
  
; Failure: HTTP/1.1 401 Unauthorized - This server could not verify that you are authorized to access the document you requested.  Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
+
== Examples ==
  
=== Examples ===
+
=== Successfully list images ===
'''Successfully list images'''
+
'''Request'''
:'''GET''' {api_server}/images
+
<nowiki>
 +
GET /accounts/{accountId}/flexcloud/images
 +
Authorization: Basic {Base64-encoded username:password string} </nowiki>
  
''Request Headers:''
+
'''Response'''
    Content-Type:application/json
+
<nowiki>
    Charset=UTF-8
+
200 OK
    Authorization:Base64-encoded username & password string
+
  
''Response Code:''
+
{
<pre>HTTP/1.1 200 OK</pre>
+
  "images": [
 +
    {
 +
      "name": "test_public_image",
 +
      "links": [
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/123/", "rel": "self"},
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/123/", "rel": "bookmark"}
 +
      ],
 +
      "id": "123",
 +
      "zones": ["AUS001"]
 +
    },
 +
    {
 +
      "name": "test_debian_image",
 +
      "links": [
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/290/", "rel": "self"},
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/290/", "rel": "bookmark"}
 +
      ],
 +
      "id": "290",
 +
      "zones": ["AUS001"]
 +
    },
 +
    {
 +
      "name": "test_private_image",
 +
      "links":  [
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/233/", "rel": "self"},
 +
        {"href": "</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/233/", "rel": "bookmark"}
 +
      ],
 +
      "id": "233",
 +
      "zones": ["AUS001"]
 +
    }
 +
  ]
 +
}</nowiki>
  
''Response Body:''
+
=== Failure while trying to make an unauthorized request ===
 +
'''Request'''
 
  <nowiki>
 
  <nowiki>
    {
+
GET /accounts/{accountId}/flexcloud/images
      "images": [
+
Authorization: Basic {invalid authorization} </nowiki>
          {
+
            "name": "test_public_image",
+
            "links": [
+
                {
+
                  "href": "http://{api_server}/images/123/",
+
                  "rel": "self"
+
                },
+
                {
+
                  "href": "http://{api_server}/images/123/",
+
                  "rel": "bookmark"
+
                }
+
            ],
+
            "id": "123"
+
          },
+
          {
+
            "name": "test_debian_image",
+
            "links": [
+
                {
+
                    "href": "http://{api_server}/images/290/",
+
                    "rel": "self"
+
                },
+
                {
+
                    "href": "http://{api_server}/images/290/",
+
                    "rel": "bookmark"
+
                }
+
              ],
+
              "id": "290"
+
          },
+
          {
+
              "name": "test_private_image",
+
              "links":  [
+
                  {
+
                    "href": "http://{api_server}/images/233/",
+
                    "rel": "self"
+
                  },
+
                  {
+
                    "href": "http://{api_server}/images/233/",
+
                    "rel": "bookmark"
+
                  }
+
              ],
+
              "id": "233"
+
          }
+
      ]
+
    }
+
</nowiki>
+
  
 +
'''Response'''
 +
<nowiki>
 +
401 Unauthorized </nowiki>
  
'''Failure while trying to make an unauthorized request'''
 
:'''GET''' {api_server}/images
 
  
''Request Headers:''
+
=== Account Number not found ===
    Content-Type:application/json
+
'''Request'''
    Charset=UTF-8
+
<nowiki>
    Authorization:Base64-encoded <span style="color:red">fake_authentication_string</span>
+
GET /accounts/fake/flexcloud/images
 +
Authorization: Basic {Base64-encoded username:password string}</nowiki>
  
''Response Code:''
+
'''Response'''
<pre>HTTP/1.1 401 Unauthorized</pre>
+
<nowiki>
 +
{
 +
    "itemNotFound": {
 +
        "guid": "23684df5-0532-4794-802d-fdc82e4e7e7c",
 +
        "message": "Resource not found",
 +
        "code": 404,
 +
        "details": ""
 +
    }
 +
}</nowiki>
  
''Response Body:''
+
== Alternative URI /images ==
    401 Unauthorized
+
An alternative way to execute this call is to omit the ''accountId'' portion of the URI. In this case the system assumes the request is executed for the account identified in the [[Authentication|authorization header]].
    This server could not verify that you are authorized to
+
    access the document you requested. Either you supplied the
+
    wrong credentials (e.g., bad password), or your browser
+
    does not understand how to supply the credentials required.
+
  
[[Category:Hostway API]]
+
<code>GET /images</code>
[[Category:FlexCloud Server API]]
+
  
<!--  THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING-->
+
== See also ==
 +
* [[FlexCloud Server|FlexCloud Server API]]
 +
* [[Common Features]]
  
{{#widget:DISQUS
+
{{disqus}}
|id=hostway
+
[[Category:Hostway API]]
|uniqid={{PAGENAME}}
+
[[Category:FlexCloud Server API]]
|url={{fullurl:{{PAGENAME}}}}
+
}}
+
 
+
<!--  ########################################################################### -->
+

Latest revision as of 11:00, 11 October 2013

GET /accounts/{accountId}/flexcloud/images?name={imageName}&status={imageStatus}&type={imageType}&zone={zoneId}

Lists all images.

Contents

Request

GET /accounts/{accountId}/flexcloud/images?name={imageName}&status={imageStatus}&type={imageType}&zone={zoneId}

Parameters

accountId - string
The selected account Id.
name - string
Optional image name to search for.
status - string
Optional Image status to search for. Values: ACTIVE, SAVING, DELETED.
type - string
Optional type of the image to search for. Values: BASE, SERVER.
zone - string
Optional the zone where the image is available.

Response

Status Code

200 OK
Success
401 Unauthorized
Failure - This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
404 Not Found
Failure - The Resource does not exist

Response Body

{
  "images":[
    {
      "name":"{display_image_name}",
      "links":[
        {"href":"https://api.hostway.com/accounts/{accountId}/flexcloud/images/{image_id}/", "rel":"self"},
        {"href":"https://api.hostway.com/accounts/{accountId}/flexcloud/images/{image_id}/", "rel":"bookmark"}
      ],
      "id": "{image_id}",
      "zones": ["{zone_id_1}", "{zone_id_2}"]
    },
    {
      "name":"{display_image_name}",
      "links":[
        {"href":"https://api.hostway.com/accounts/{accountId}/flexcloud/images/{image_id}/", "rel":"self"},
        {"href":"https://api.hostway.com/accounts/{accountId}/flexcloud/images/{image_id}/", "rel":"bookmark"}
      ],
      "id":"{image_id}",
      "zones": ["{zone_id}"]
    }
  ]
}

Parameters

id - string
Unique identifier for this image.
links - array
Hypermedia for this resource.
name - string
Display name for this image.
zones - string
Zones where the image is available.

Examples

Successfully list images

Request

GET /accounts/{accountId}/flexcloud/images
Authorization: Basic {Base64-encoded username:password string} 

Response

200 OK

{
  "images": [
    {
      "name": "test_public_image", 
      "links": [
        {"href": "https://api.hostway.com/accounts/{accountId}/flexcloud/images/123/", "rel": "self"},
        {"href": "https://api.hostway.com/accounts/{accountId}/flexcloud/images/123/", "rel": "bookmark"}
      ], 
      "id": "123",
      "zones": ["AUS001"]
    }, 
    {
      "name": "test_debian_image", 
      "links": [
        {"href": "https://api.hostway.com/accounts/{accountId}/flexcloud/images/290/", "rel": "self"},
        {"href": "https://api.hostway.com/accounts/{accountId}/flexcloud/images/290/", "rel": "bookmark"}
      ], 
      "id": "290",
      "zones": ["AUS001"]
    },
    {
      "name": "test_private_image", 
      "links":  [
        {"href": "https://api.hostway.com/accounts/{accountId}/flexcloud/images/233/", "rel": "self"},
        {"href": "https://api.hostway.com/accounts/{accountId}/flexcloud/images/233/", "rel": "bookmark"}
      ], 
      "id": "233",
      "zones": ["AUS001"]
    }
  ]
}

Failure while trying to make an unauthorized request

Request

GET /accounts/{accountId}/flexcloud/images
Authorization: Basic {invalid authorization} 

Response

401 Unauthorized 


Account Number not found

Request

GET /accounts/fake/flexcloud/images
Authorization: Basic {Base64-encoded username:password string}

Response

{
    "itemNotFound": {
        "guid": "23684df5-0532-4794-802d-fdc82e4e7e7c",
        "message": "Resource not found",
        "code": 404,
        "details": ""
    }
}

Alternative URI /images

An alternative way to execute this call is to omit the accountId portion of the URI. In this case the system assumes the request is executed for the account identified in the authorization header.

GET /images

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox