ImageList

(Difference between revisions)
Jump to: navigation, search
Line 8: Line 8:
 
== Result ==
 
== Result ==
 
=== JSON ===
 
=== JSON ===
<big><source lang="javascript">
+
<nowiki>
 
{
 
{
 
   "images":[
 
   "images":[
Line 41: Line 41:
 
   ]
 
   ]
 
}
 
}
</source></big>
+
</nowiki>
 
+
  
 
; id - ''string''
 
; id - ''string''
Line 59: Line 58:
  
 
== Examples ==
 
== Examples ==
'''List images'''
+
'''Successfully list images'''
 
:'''GET''' {api_server}/images
 
:'''GET''' {api_server}/images
  
Line 71: Line 70:
  
 
''Response Body:''
 
''Response Body:''
<big><source lang="javascript">
+
<nowiki>
 
     {
 
     {
 
       "images": [
 
       "images": [
Line 101: Line 100:
 
               ],  
 
               ],  
 
               "id": "290"
 
               "id": "290"
           },  
+
           },
 
           {
 
           {
            "name": "test_private_image",  
+
              "name": "test_private_image",  
            "links": [
+
              "links": [
                {
+
                  {
                    "href": "http://{api_server}/images/233/",  
+
                    "href": "http://{api_server}/images/233/",  
                    "rel": "self"
+
                    "rel": "self"
                },  
+
                  },
                {
+
                  {
                    "href": "http://{api_server}/images/233/",  
+
                    "href": "http://{api_server}/images/233/",  
                    "rel": "bookmark"
+
                    "rel": "bookmark"
                }
+
                  }
 
               ],  
 
               ],  
 
               "id": "233"
 
               "id": "233"
          }  
+
          }
 
       ]
 
       ]
 
     }
 
     }
</source></big>
+
</nowiki>
  
  
'''Unauthorized request'''
+
'''Failure while trying to make an unauthorized request'''
 
:'''GET''' {api_server}/images
 
:'''GET''' {api_server}/images
  
 
''Request Headers:''
 
''Request Headers:''
 
     Content-Type:application/json
 
     Content-Type:application/json
 +
    Charset=UTF-8
 +
    Authorization:Base64-encoded <span style="color:red">fake_authentication_string</span>
  
 
''Response Code:''
 
''Response Code:''

Revision as of 15:56, 4 July 2012

This operation will list all images.

GET /images

Contents

Parameters

No parameters

Result

JSON

{
   "images":[
      {
         "name":"{display_image_name}",
         "links":[
            {
               "href":"http://{api_server}/images/{image_id}/",
               "rel":"self"
            },
            {
               "href":"http://{api_server}/images/{image_id}/",
               "rel":"bookmark"
            }
         ],
         "id":"{image_id}"
      },
      {
         "name":"{display_image_name}",
         "links":[
            {
               "href":"http://{api_server}/images/{image_id}/",
               "rel":"self"
            },
            {
               "href":"http://{api_server}/images/{image_id}/",
               "rel":"bookmark"
            }
         ],
         "id":"{image_id}"
      }
   ]
}

id - string
Unique identifier for this image.
links - array
Hypermedia for this resource.
name - string
Display name for this image.

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.

Examples

Successfully list images

GET {api_server}/images

Request Headers:

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

Response Code:

HTTP/1.1 200 OK

Response Body:

     {
       "images": [
          {
             "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"
           }
       ]
    }


Failure while trying to make an unauthorized request

GET {api_server}/images

Request Headers:

   Content-Type:application/json
   Charset=UTF-8
   Authorization:Base64-encoded fake_authentication_string

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.


blog comments powered by Disqus


Personal tools
Namespaces
Variants
Actions
APIs
Navigation
Toolbox