Image

(Difference between revisions)
Jump to: navigation, search
m (1 revision)
Line 1: Line 1:
This operation will return details of a single image.
+
= GET /images/''{id}'' =
 +
Returns details for a single image.
 +
__TOC__
 +
== Request ==
 +
<code>GET /images/''{id}''</code>
  
'''GET''' /images/'''id'''
+
=== Parameters ===
 
+
== Parameters ==
+
 
; id
 
; id
 
: The unique identifier of the image to be retrieved. ''Note see warnings in [[Hypermedia]]''.
 
: The unique identifier of the image to be retrieved. ''Note see warnings in [[Hypermedia]]''.
  
== Result ==
+
== Response ==
=== JSON ===
+
 
 +
=== Status Code ===
 +
; 200 OK
 +
: Success
 +
 
 +
; 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.
 +
 
 +
; 403 Forbidden
 +
; The resource is forbidden for this user
 +
 
 +
; 404 Not Found
 +
: The resource does not exist
 +
 
 +
=== Response Body ===
 
  <nowiki>
 
  <nowiki>
 
{
 
{
  "image":{
+
  "image":{
      "status":"SAVING",
+
    "status":"SAVING",
      "updated":null,
+
    "updated":null,
      "name":"{display_image_name}",
+
    "name":"{display_image_name}",
      "links":[
+
    "links":[
        {
+
      {"href":"</nowiki>{{APIBaseURL}}<nowiki>/images/{image_id}/", "rel":"self"},
            "href":"http://{api_server}/images/{image_id}/",
+
      {"href":"</nowiki>{{APIBaseURL}}<nowiki>/images/{image_id}/", "rel":"bookmark"}
            "rel":"self"
+
    ],
        },
+
    "created":"yyyy-mm-ddThh:mm:ss",
        {
+
    "id":"{image_id}",
            "href":"http://{api_server}/images/{image_id}/",
+
    "zones":["{zone_id}"]
            "rel":"bookmark"
+
  }
        }
+
      ],
+
      "created":"2011-09-30T02:38:57",
+
      "id":"{image_id}",
+
      "zones": ["{zone_textkey}"]
+
  }
+
 
}
 
}
 
</nowiki>
 
</nowiki>
  
 +
==== Parameters ====
 
; id - ''string''
 
; id - ''string''
 
: Unique identifier for this image.
 
: Unique identifier for this image.
Line 43: Line 54:
 
; status - ''string''
 
; status - ''string''
 
: Current state of this image. Valid values are ACTIVE, SAVING, DELETED.
 
: Current state of this image. Valid values are ACTIVE, SAVING, DELETED.
: '''ACTIVE''' - Image is ready to be used.
+
:: '''ACTIVE''' - Image is ready to be used.
: '''SAVING''' - Image is being uploaded or saved from a running [[Server]] instance.
+
:: '''SAVING''' - Image is being uploaded or saved from a running [[Server]] instance.
: '''DELETED''' - Image was recently deleted or is in the process of being deleted.
+
:: '''DELETED''' - Image was recently deleted or is in the process of being deleted.
  
 
; created - ''string''
 
; created - ''string''
Line 54: Line 65:
  
 
; zones - ''string''
 
; zones - ''string''
: Zone textkey
+
: Zones where the image is available.
 
+
== Response Codes ==
+
; Success:
+
:''HTTP/1.1 200 OK''
+
 
+
; 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.
+
:''HTTP/1.1 403 Forbidden'' - The resource is forbidden for this user
+
:''HTTP/1.1 404 Not Found'' - The resource does not exist
+
  
 
== Examples ==
 
== Examples ==
'''Successfully view image'''
 
:'''GET''' <nowiki>http://{api_server}/images/133</nowiki>
 
  
''Request Headers:''
+
=== Successfully view image ===
    Content-Type:application/json
+
'''Request'''
    Charset=UTF-8
+
<nowiki>
    Authorization:Base64-encoded username & password string
+
GET /images/133
 
+
Authorization: Basic {Base64-encoded username:password string}
''Response Code:''
+
</nowiki>
<pre>HTTP/1.1 200 OK</pre>
+
  
''Response Body:''
+
'''Response'''
 
  <nowiki>
 
  <nowiki>
{
+
200 OK
    "image":  
+
 
      {
+
{
          "status": "SAVING",  
+
  "image": {
          "updated": null,  
+
    "status": "SAVING",  
          "name": "test_debian_image",  
+
    "updated": null,  
          "links": [
+
    "name": "test_debian_image",  
            {
+
    "links": [
                "href": "http://{api_server}/images/133/",  
+
      {"href": "</nowiki>{{APIBaseURL}}<nowiki>/images/133/", "rel": "self"},
                "rel": "self"
+
      {"href": "</nowiki>{{APIBaseURL}}<nowiki>/images/133/", "rel": "bookmark"}
            },
+
    ],
            {
+
    "created": "2011-09-30T02:38:57",  
                "href": "http://{api_server}/images/133/",  
+
    "id": "133",
                "rel": "bookmark"
+
    "zones": ["AUS001"]
            }
+
  }
          ],  
+
}
          "created": "2011-09-30T02:38:57",  
+
          "id": "133",
+
          "zones": ["AUS001"]
+
      }
+
}
+
 
</nowiki>
 
</nowiki>
  
'''Failure while trying to make an unauthorized request'''
+
=== Failure while trying to make an unauthorized request ===
:'''GET''' <nowiki>http://{api_server}/images/{image_id}</nowiki>
+
'''Request'''
 +
<nowiki>
 +
GET /images/133
 +
Authorization: Basic {invalid authorization}
 +
</nowiki>
  
''Request Headers:''
+
'''Response'''
    Content-Type:application/json
+
<nowiki>
    Charset=UTF-8
+
401 Unauthorized
    Authorization:Base64-encoded <span style="color:red">fake_authentication_string</span>
+
</nowiki>
  
''Response Code:''
+
=== Permission denied failure ===
<pre>HTTP/1.1 401 Unauthorized</pre>
+
'''Request'''
 +
<nowiki>
 +
GET /images/122
 +
Authorization: Basic {Base64-encoded username:password string}
 +
</nowiki>
  
''Response Body:''
+
'''Response'''
    401 Unauthorized
+
  <nowiki>
    This server could not verify that you are authorized to
+
403 Forbidden
    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.
+
  
'''Permission denied failure'''
+
{
:'''GET''' http(s)://{api_server}/images/{image_id}
+
  "forbidden": {
 +
    "message": "forbidden",
 +
    "code": 403,
 +
    "details": "",
 +
    "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
 +
  }
 +
}
 +
</nowiki>
  
''Request Headers:''
+
=== Failure while trying to request for an image that does not exist ===
    Content-Type:application/json
+
'''Request'''
    Charset=UTF-8
+
<nowiki>
    Authorization:Base64-encoded username & password string
+
GET /images/missing_image_id
 +
Authorization: Basic {Base64-encoded username:password string}
 +
</nowiki>
  
''Response Code:''
+
'''Response'''
<pre>HTTP/1.1 403 Forbidden</pre>
+
<nowiki>
 +
404 Not Found
  
''Response Body:''
+
{
{
+
  "itemNotFound": {
    "forbidden":  
+
    "message": "Resource not found",  
      {
+
    "code": 404,  
          "message": "forbidden",  
+
    "details": "",
          "code": 403,  
+
    "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
          "details": "",
+
  }
          "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
+
}
      }
+
</nowiki>
}
+
 
+
'''Failure while trying to request for an image that does not exist'''
+
:'''GET''' http(s)://{api_server}/images/{<span style="color:red">fake_image_id</span>}
+
 
+
''Request Headers:''
+
    Content-Type:application/json
+
    Charset=UTF-8
+
    Authorization:Base64-encoded username & password string
+
 
+
''Response Code:''
+
<pre>HTTP/1.1 404 Not Found</pre>
+
  
''Response Body:''
+
== See also ==
{
+
* [[FlexCloud Server|FlexCloud Server API]]
    "itemNotFound":
+
* [[Common Features]]
      {
+
          "message": "Resource not found",
+
          "code": 404,
+
          "details": "",
+
          "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
+
      }
+
}
+
  
 +
{{disqus}}
 
[[Category:Hostway API]]
 
[[Category:Hostway API]]
 
[[Category:FlexCloud Server API]]
 
[[Category:FlexCloud Server API]]

Revision as of 14:36, 24 May 2013

GET /images/{id}

Returns details for a single image.

Contents

Request

GET /images/{id}

Parameters

id
The unique identifier of the image to be retrieved. Note see warnings in Hypermedia.

Response

Status Code

200 OK
Success
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.
403 Forbidden
The resource is forbidden for this user
404 Not Found
The resource does not exist

Response Body

{
  "image":{
    "status":"SAVING",
    "updated":null,
    "name":"{display_image_name}",
    "links":[
      {"href":"https://api.hostway.com/images/{image_id}/", "rel":"self"},
      {"href":"https://api.hostway.com/images/{image_id}/", "rel":"bookmark"}
    ],
    "created":"yyyy-mm-ddThh:mm:ss",
    "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.
status - string
Current state of this image. Valid values are ACTIVE, SAVING, DELETED.
ACTIVE - Image is ready to be used.
SAVING - Image is being uploaded or saved from a running Server instance.
DELETED - Image was recently deleted or is in the process of being deleted.
created - string
The date and time the image was created. ISO 8601 format, YYYY-MM-DDTHH:MM:SS.
updated
Unused always null.
zones - string
Zones where the image is available.

Examples

Successfully view image

Request

GET /images/133
Authorization: Basic {Base64-encoded username:password string}
 

Response

200 OK

{
  "image": {
    "status": "SAVING", 
    "updated": null, 
    "name": "test_debian_image", 
    "links": [
      {"href": "https://api.hostway.com/images/133/", "rel": "self"},
      {"href": "https://api.hostway.com/images/133/", "rel": "bookmark"}
    ],
    "created": "2011-09-30T02:38:57", 
    "id": "133",
    "zones": ["AUS001"]
  }
}

Failure while trying to make an unauthorized request

Request

GET /images/133
Authorization: Basic {invalid authorization}
 

Response

401 Unauthorized
 

Permission denied failure

Request

GET /images/122
Authorization: Basic {Base64-encoded username:password string}
 

Response

403 Forbidden

{
  "forbidden": {
    "message": "forbidden", 
    "code": 403, 
    "details": "",
    "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
  }
}
 

Failure while trying to request for an image that does not exist

Request

GET /images/missing_image_id
Authorization: Basic {Base64-encoded username:password string}
 

Response

404 Not Found

{
  "itemNotFound": {
    "message": "Resource not found", 
    "code": 404, 
    "details": "",
    "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
  }
}
 

See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox