Image

From Hostway API Documentation
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
m (1 revision: Release 86)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This operation will return details of a single image.
+
= GET /accounts/''{accountId}''/flexcloud/images/''{id}'' =
 +
Returns details for a single image.
 +
__TOC__
 +
== Request ==
 +
<code>GET /accounts/''{accountId}''/flexcloud/images/''{id}''</code>
  
'''GET''' /images/'''id'''
+
=== Parameters ===
 +
; accountId
 +
: The selected account Id.
  
== 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>/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"
+
    ],
        },
+
    "created":"yyyy-mm-ddThh:mm:ss",
        {
+
    "id":"{image_id}",
            "href":"http://{api_server}/images/{image_id}/",
+
    "zones":["{zone_id}"]
            "rel":"bookmark"
+
  }
        }
+
}</nowiki>
      ],
+
      "created":"2011-09-30T02:38:57",
+
      "id":"{image_id}",
+
      "zones": ["{zone_textkey}"]
+
  }
+
}
+
</nowiki>
+
  
 +
==== Parameters ====
 
; id - ''string''
 
; id - ''string''
 
: Unique identifier for this image.
 
: Unique identifier for this image.
Line 43: Line 56:
 
; 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 67:
  
 
; zones - ''string''
 
; zones - ''string''
: Zone textkey
+
: Zones where the image is available.
  
== Response Codes ==
+
== Examples ==
; Success:
+
:''HTTP/1.1 200 OK''
+
  
; Failure:
+
=== Successfully view image ===
:''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.
+
'''Request'''
:''HTTP/1.1 403 Forbidden'' - The resource is forbidden for this user
+
  <nowiki>
:''HTTP/1.1 404 Not Found'' - The resource does not exist
+
GET /accounts/{accountId}/flexcloud/images/133
 +
Authorization: Basic {Base64-encoded username:password string} </nowiki>
  
== Examples ==
+
'''Response'''
'''Successfully view image'''
+
<nowiki>
:'''GET''' <nowiki>http://{api_server}/images/133</nowiki>
+
200 OK
  
''Request Headers:''
+
{
     Content-Type:application/json
+
  "image": {
     Charset=UTF-8
+
     "status": "SAVING",
     Authorization:Base64-encoded username & password string
+
    "updated": null,
 +
    "name": "test_debian_image",
 +
    "links": [
 +
      {"href": "</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/133/", "rel": "self"},
 +
      {"href": "</nowiki>{{APIBaseURL}}<nowiki>/accounts/{accountId}/flexcloud/images/133/", "rel": "bookmark"}
 +
     ],
 +
     "created": "2011-09-30T02:38:57",
 +
    "id": "133",
 +
    "zones": ["AUS001"]
 +
  }
 +
}</nowiki>
  
''Response Code:''
+
=== Failure while trying to make an unauthorized request ===
<pre>HTTP/1.1 200 OK</pre>
+
'''Request'''
 +
<nowiki>
 +
GET /accounts/{accountId}/flexcloud/images/133
 +
Authorization: Basic {invalid authorization} </nowiki>
  
''Response Body:''
+
'''Response'''
 
  <nowiki>
 
  <nowiki>
{
+
401 Unauthorized </nowiki>
    "image":
+
      {
+
          "status": "SAVING",
+
          "updated": null,
+
          "name": "test_debian_image",
+
          "links": [
+
            {
+
                "href": "http://{api_server}/images/133/",
+
                "rel": "self"
+
            },
+
            {
+
                "href": "http://{api_server}/images/133/",
+
                "rel": "bookmark"
+
            }
+
          ],
+
          "created": "2011-09-30T02:38:57",
+
          "id": "133",
+
          "zones": ["AUS001"]
+
      }
+
}
+
</nowiki>
+
  
'''Failure while trying to make an unauthorized request'''
+
=== Permission denied failure ===
:'''GET''' <nowiki>http://{api_server}/images/{image_id}</nowiki>
+
'''Request'''
 +
<nowiki>
 +
GET /accounts/{accountId}/flexcloud/images/122
 +
Authorization: Basic {Base64-encoded username:password string} </nowiki>
  
''Request Headers:''
+
'''Response'''
    Content-Type:application/json
+
<nowiki>
    Charset=UTF-8
+
403 Forbidden
    Authorization:Base64-encoded <span style="color:red">fake_authentication_string</span>
+
  
''Response Code:''
+
{
<pre>HTTP/1.1 401 Unauthorized</pre>
+
  "forbidden": {
 +
    "message": "forbidden",
 +
    "code": 403,
 +
    "details": "",
 +
    "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
 +
  }
 +
} </nowiki>
  
''Response Body:''
+
=== Failure while trying to request for an image that does not exist ===
    401 Unauthorized
+
'''Request'''
    This server could not verify that you are authorized to
+
  <nowiki>
    access the document you requested. Either you supplied the
+
GET /accounts/{accountId}/flexcloud/images/missing_image_id
    wrong credentials (e.g., bad password), or your browser
+
Authorization: Basic {Base64-encoded username:password string} </nowiki>
    does not understand how to supply the credentials required.
+
  
'''Permission denied failure'''
+
'''Response'''
:'''GET''' http(s)://{api_server}/images/{image_id}
+
<nowiki>
 +
404 Not Found
  
''Request Headers:''
+
{
     Content-Type:application/json
+
  "itemNotFound": {
     Charset=UTF-8
+
     "message": "Resource not found",
     Authorization:Base64-encoded username & password string
+
     "code": 404,
 +
     "details": "",
 +
    "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
 +
  }
 +
} </nowiki>
  
''Response Code:''
 
<pre>HTTP/1.1 403 Forbidden</pre>
 
  
''Response Body:''
+
=== Account Number not found ===
  {
+
'''Request'''
    "forbidden":  
+
  <nowiki>
      {
+
GET /accounts/fake/flexcloud/images/122
          "message": "forbidden",
+
Authorization: Basic {Base64-encoded username:password string}</nowiki>
          "code": 403,
+
          "details": "",
+
          "errorid": "59e0b3dd-2173-432a-8ff5-60efe16e83bf"
+
      }
+
}
+
  
'''Failure while trying to request for an image that does not exist'''
+
'''Response'''
:'''GET''' http(s)://{api_server}/images/{<span style="color:red">fake_image_id</span>}
+
<nowiki>
 +
{
 +
    "itemNotFound": {
 +
        "guid": "23684df5-0532-4794-802d-fdc82e4e7e7c",
 +
        "message": "Resource not found",
 +
        "code": 404,
 +
        "details": ""
 +
    }
 +
}</nowiki>
  
''Request Headers:''
+
== Alternative URI /images/{id} ==
    Content-Type:application/json
+
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]].
    Charset=UTF-8
+
    Authorization:Base64-encoded username & password string
+
  
''Response Code:''
+
<code>GET /images/{id}</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]]

Latest revision as of 12:00, 11 October 2013

[edit] GET /accounts/{accountId}/flexcloud/images/{id}

Returns details for a single image.

Contents

[edit] Request

GET /accounts/{accountId}/flexcloud/images/{id}

[edit] Parameters

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

[edit] Response

[edit] 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

[edit] Response Body

{
  "image":{
    "status":"SAVING",
    "updated":null,
    "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"}
    ],
    "created":"yyyy-mm-ddThh:mm:ss",
    "id":"{image_id}",
    "zones":["{zone_id}"]
  }
}

[edit] 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.

[edit] Examples

[edit] Successfully view image

Request

GET /accounts/{accountId}/flexcloud/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/accounts/{accountId}/flexcloud/images/133/", "rel": "self"},
      {"href": "https://api.hostway.com/accounts/{accountId}/flexcloud/images/133/", "rel": "bookmark"}
    ],
    "created": "2011-09-30T02:38:57", 
    "id": "133",
    "zones": ["AUS001"]
  }
}

[edit] Failure while trying to make an unauthorized request

Request

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

Response

401 Unauthorized 

[edit] Permission denied failure

Request

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

Response

403 Forbidden

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

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

Request

GET /accounts/{accountId}/flexcloud/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"
  }
} 


[edit] Account Number not found

Request

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

Response

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

[edit] Alternative URI /images/{id}

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/{id}

[edit] See also


blog comments powered by Disqus

Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox