Jump to: navigation, search

Difference between revisions of "Blazar/REST API"

(List all leases)
(List all leases)
Line 69: Line 69:
 
''Response:''
 
''Response:''
  
     '''HTTP/1.1 200 OK'''
+
     ''HTTP/1.1 200 OK''
     '''Content-Type: application/json'''
+
     ''Content-Type: application/json''
 
   
 
   
 
  {
 
  {

Revision as of 09:26, 3 February 2014

General API information

This page contains base information about the Climate REST API design, including operations with different Climate resource types and examples of possible requests and responses. Climate supports JSON data serialization format, which means that requests with non empty body have to contain "application/json" Content-Type header or it should be added ".json" extension to the resource name in the request.

This should look like the following:

   GET /v1/{tenant_id}/leases.json

or

   GET /v1/{tenant_id}/leases
   Accept: application/json

Leases

Lease is the main abstraction for the user in the Climate case. Lease means some kind of contract where start time, end time and resources to be reserved are mentioned.

Lease ops

Verb URI Description
GET
/v1/leases 
Lists all leases registered in Climate for tenant defined in headers.
POST 
/v1/leases 
Create new lease with passed parameters.
GET 
/v1/leases/{lease_id}
Shows information about specified lease.
PUT 
/v1/leases/{lease_id}
Updates specified lease (only name modification and prolonging are possible).
DELETE
/v1/leases/{lease_id}
Deletes specified lease and frees all reserved resources.

List all leases

 /v1/leases
  • Normal Response Code: 200 (OK)
  • Returns the list of all leases.
  • Does not require a request body.


Example

Request:

  GET http://climate_node:1234/v1/leases

Response:

   HTTP/1.1 200 OK
   Content-Type: application/json

{
   "leases": [
       {
           "id": "aaaa-bbbb-cccc-dddd",
           "name": "lease_foo_1",
           "start_date": "1234",
           "end_date": "2345",
           "reservations": [{...}],
           "events": [{...}]
       },
       {
           "id": "eeee-ffff-gggg-hhhh",
           "name": "lease_foo_2",
           "start_date": "1234",
           "end_date": "2345",
           "reservations": [{...}],
           "events": [{...}]
       }
   ]
}

Show info about lease

TBD