Image

(Difference between revisions)
Jump to: navigation, search
Line 9: Line 9:
 
== Result ==
 
== Result ==
 
=== JSON ===
 
=== JSON ===
 
 
<big><source lang="javascript">
 
<big><source lang="javascript">
 
{
 
{
Line 15: Line 14:
 
       "status":"SAVING",
 
       "status":"SAVING",
 
       "updated":null,
 
       "updated":null,
       "name":"debian",
+
       "name":"{display_image_name}",
 
       "links":[
 
       "links":[
 
         {
 
         {
             "href":"http://127.0.0.1:6543/images/debian_lenny_template/",
+
             "href":"http://{server_name}/images/{image_id}/",
 
             "rel":"self"
 
             "rel":"self"
 
         },
 
         },
 
         {
 
         {
             "href":"http://127.0.0.1:6543/images/debian_lenny_template/",
+
             "href":"http://{server_name}/images/{image_id}/",
 
             "rel":"bookmark"
 
             "rel":"bookmark"
 
         }
 
         }
 
       ],
 
       ],
 
       "created":"2011-09-30T02:38:57",
 
       "created":"2011-09-30T02:38:57",
       "id":"debian_lenny_template"
+
       "id":"{image_id}"
 
   }
 
   }
 
}
 
}
Line 40: Line 39:
  
 
; name - ''string''
 
; name - ''string''
: Descriptive name for this image.
+
: Display name for this image.
  
 
; status - ''string''
 
; status - ''string''
Line 53: Line 52:
 
; updated
 
; updated
 
: Unused always null.
 
: Unused always null.
 +
 +
== 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 ==
 +
'''View image'''
 +
:'''GET''' <nowiki>http://{api_url}/images/{image_id}</nowiki>
 +
 +
''Request Headers:''
 +
    Content-Type:application/json
 +
    Charset=UTF-8
 +
    Authorization:Base64-encoded username & password string
 +
 +
''Response Code:''
 +
<pre>HTTP/1.1 200 OK</pre>
 +
 +
''Response Body:''
 +
    {"image": {"status": "SAVING", "updated": null, "name": "{display_image_name}", "links": [{"href": "<nowiki>http://{server_name}/images/{image_id}/</nowiki>", "rel": "self"},
 +
      {"href": "<nowiki>http://{server_name}/images/{image_id}/</nowiki>", "rel": "bookmark"}], "created": "2011-09-30T02:38:57", "id": "{image_id}"}}
 +
 +
 +
'''Unauthorized request'''
 +
:'''GET''' <nowiki>http://{api_url}/images/{image_id}</nowiki>
 +
 +
''Request Headers:''
 +
    Content-Type:application/json
 +
 +
''Response Code:''
 +
<pre>HTTP/1.1 401 Unauthorized</pre>
 +
 +
''Response Body:''
 +
    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.
 +
 +
'''Permission denied'''
 +
:'''GET''' <nowiki>http://{api_url}/images/{image_id}</nowiki>
 +
 +
''Request Headers:''
 +
    Content-Type:application/json
 +
    Charset=UTF-8
 +
    Authorization:Base64-encoded username & password string
 +
 +
''Response Code:''
 +
<pre>HTTP/1.1 403 Forbidden</pre>
 +
 +
''Response Body:''
 +
    {"forbidden": {"message": "forbidden", "code": 403, "details": ""}}
 +
 +
 +
'''Request for image that does not exist'''
 +
:'''GET''' <nowiki>http://{api_url}/images/{fake_image_id}</nowiki>
 +
 +
''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:''
 +
    {"itemNotFound": {"message": "Resource not found", "code": 404, "details": ""}}
 +
  
 
<!--  THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING-->
 
<!--  THIS CODE ENABLES DISQUS COMMENTS ON THE PAGE - DELETE TO DISABLE COMMENTING-->

Revision as of 18:30, 12 April 2012

This operation will return details of a single image.

GET /images/id

Contents

Parameters

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

Result

JSON

{
   "image":{
      "status":"SAVING",
      "updated":null,
      "name":"{display_image_name}",
      "links":[
         {
            "href":"http://{server_name}/images/{image_id}/",
            "rel":"self"
         },
         {
            "href":"http://{server_name}/images/{image_id}/",
            "rel":"bookmark"
         }
      ],
      "created":"2011-09-30T02:38:57",
      "id":"{image_id}"
   }
}


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.

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

View image

GET http://{api_url}/images/{image_id}

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Response Code:

HTTP/1.1 200 OK

Response Body:

    {"image": {"status": "SAVING", "updated": null, "name": "{display_image_name}", "links": [{"href": "http://{server_name}/images/{image_id}/", "rel": "self"},
     {"href": "http://{server_name}/images/{image_id}/", "rel": "bookmark"}], "created": "2011-09-30T02:38:57", "id": "{image_id}"}}


Unauthorized request

GET http://{api_url}/images/{image_id}

Request Headers:

   Content-Type:application/json

Response Code:

HTTP/1.1 401 Unauthorized

Response Body:

    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.

Permission denied

GET http://{api_url}/images/{image_id}

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Response Code:

HTTP/1.1 403 Forbidden

Response Body:

    {"forbidden": {"message": "forbidden", "code": 403, "details": ""}}


Request for image that does not exist

GET http://{api_url}/images/{fake_image_id}

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded username & password string

Response Code:

HTTP/1.1 404 Not Found

Response Body:

    {"itemNotFound": {"message": "Resource not found", "code": 404, "details": ""}}


blog comments powered by Disqus


Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox