Jump to: navigation, search

MagnetoDB/specs/data-api

< MagnetoDB
Revision as of 15:53, 7 March 2014 by Achudnovets (talk | contribs) (Created page with "= [Draft] MagnetoDB API = === Headers === * User-Agent * Content-Type * Accept * X-Auth-Token keystone auth token === Common Errors === This section lists the common errors th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

[Draft] MagnetoDB API

Headers

  • User-Agent
  • Content-Type
  • Accept
  • X-Auth-Token keystone auth token

Common Errors

This section lists the common errors that all actions return. Any action-specific errors will be listed in the topic for the action.

computeFault
Unknown error, exception or failure.
HTTP Status Code: 500
quotaExceeded
Server is overloaded or caller has exceeded request quota.
HTTP Status Code: 429
overLimit
Caller is exceeded data storage quota.
HTTP Status Code: 413
unauthorized
The Keystone token does not exist or expired.
HTTP Status Code: 401
forbidden
Caller is not authorized for operation.
HTTP Status Code: 403
badRequest
Invalid parameter combination or invalid parameter value.
HTTP Status Code: 400
itemNotFound
Resource is not found.
HTTP Status Code: 404
serviceUnavailable
Temporary failure of the server.
HTTP Status Code: 503

Managing Tables

HTTP method URL pattern Operation description Amazon DynamoDB operation
POST v1/{project_id}/data/tables Creates a table CreateTable
PUT v1/{project_id}/data/tables/{table_name} Modifies settings for a table UpdateTable
DELETE v1/{project_id}/data/tables/{table_name} Deletes a table and all of its indexes DeleteTable
GET v1/{project_id}/data/tables Lists tables ListTables
GET v1/{project_id}/data/tables/{table_name} Describes table DescribeTable

Managing Items

HTTP method URL pattern Operation description Amazon DynamoDB operation
POST v1/{project_id}/data/tables/{table_name}/put_item Creates an item in the table PutItem
POST v1/{project_id}/data/tables/{table_name}/put_item Updates an item in the table UpdateItem
POST v1/{project_id}/data/tables/{table_name}/delete_item Deletes an item from the table DeleteItem
POST v1/{project_id}/data/tables/{table_name}/get_item Gets an item from the table GetItem
POST v1/{project_id}/data/tables/{table_name}/query Directly accesses items from a tableusing the table primary key, or from an index using the index key Query
POST v1/{project_id}/data/tables/{table_name}/scan Returns one or more items and item attributes by accessing every item in the table Scan

Batch methods

HTTP method URL pattern Operation description Amazon DynamoDB operation
POST v1/{project_id}/data/batch_get_item Returns the attributes of one or more items from one or more tables. You identify requested items by primary key BatchGetItem
POST v1/{project_id}/data/batch_write_item Puts or deletes multiple items in one or more tables BatchWriteItem

Operation details

Requests and responses should be very similar to the Amazon DynamoDB. But there should be some differences:

  • table_name parameter will be provided via URL
  • GlobalSecondaryIndexes will be added in future
  • API will use different HTTP methods for different operations (POST for create, PUT for update, etc)

Note: operations with items in the table(GetItem, PutItem, Scan, etc) will use POST method.


CreateTable

The CreateTable operation adds a new table. Table names must be unique within each tenant.

URL

POST v1/{project_id}/data/tables

Request Syntax
{
   "attribute_definitions": [
       {
           "attribute_name": "string",
           "attribute_type": "string"
       }
   ],
   "key_schema": [
       {
           "attribute_name": "string",
           "key_type": "string"
       }
   ],
   "local_secondary_indexes": [
       {
           "index_name": "string",
           "key_schema": [
               {
                   "attribute_name": "string",
                   "key_type": "string"
               }
           ],
           "projection": {
               "non_key_attributes": [
                   "string"
               ],
               "projection_type": "string"
           }
       }
   ],
   "table_name": "string"
}
Request Parameters

The request accepts the following data in JSON format.

attribute_definitions
An array of attributes that describe the key schema for the table and indexes.
Type: array of AttributeDefinition objects
Required: Yes
key_schema
Specifies the attributes that make up the primary key for a table or an index.
Type: array of key_schemaElement objects
Required: Yes
local_secondary_indexes
One or more local secondary indexes to be created on the table.
Type: array of objects
Required: No
Response Syntax
{
   "table_description": {
       "attribute_definitions": [
           {
               "attribute_name": "string",
               "attribute_type": "string"
           }
       ],
       "creation_datetime": "number",
       "item_count": "number",
       "key_schema": [
           {
               "attribute_name": "string",
               "key_type": "string"
           }
       ],
       "local_secondary_indexes": [
           {
               "index_name": "string",
               "index_size_bytes": "number",
               "item_count": "number",
               "key_schema": [
                   {
                       "attribute_name": "string",
                       "key_type": "string"
                   }
               ],
               "projection": {
                   "non_key_attributes": [
                       "string"
                   ],
                   "projection_type": "string"
               }
           }
       ],
       "links": [
           {
               "href": "url",
               "rel": "self"
           },
           {
               "href": "url",
               "rel": "bookmark"
           }
       ],
       "table_size_bytes": "number",
       "table_status": "string"
   }
}
Response Elements

The following data is returned in JSON format by the service.

table_description
Represents the properties of a table.
Type: table_description object
Errors

TBW


UpdateTable

In the MagnetoDB this operation updates provisioned throughput. We can use this operation for updating OpenStack staff and GlobalSecondaryIndexes.

URL

PUT v1/{project_id}/data/tables/{table_name}

Request Syntax

TODO

Request Parameters

TODO

Response Syntax

TODO

Response Elements

TODO

Errors

TODO


DescribeTable

Returns information about the table.

URL

GET v1/{project_id}/data/tables/{table_name}

Request Syntax

This operation does not require a request body

Response Syntax
{
   "table": {
       "attribute_definitions": [
           {
               "attribute_name": "string",
               "attribute_type": "string"
           }
       ],
       "creation_datetime": "number",
       "item_count": "number",
       "key_schema": [
           {
               "attribute_name": "string",
               "key_type": "string"
           }
       ],
       "local_secondary_indexes": [
           {
               "index_name": "string",
               "index_size_bytes": "number",
               "item_count": "number",
               "key_schema": [
                   {
                       "attribute_name": "string",
                       "key_type": "string"
                   }
               ],
               "projection": {
                   "non_key_attributes": [
                       "string"
                   ],
                   "projection_type": "string"
               }
           }
       ],
       "links": [
           {
               "href": "url",
               "rel": "self"
           }
       ],
      "table_name": "string",
      "table_size_bytes": "number",
      "table_status": "string"
   }
}
Response Elements

The following data is returned in JSON format by the service.

table
Represents the properties of a table.
Type: table_description object
Errors

TBW


DeleteTable

The DeleteTable operation deletes a table and all of its items.

URL

DELETE v1/{project_id}/data/tables/{table_name}

Request Syntax

This operation does not require a request body

Response Syntax
{
   "table_description": {
       "attribute_definitions": [
           {
               "attribute_name": "string",
               "attribute_type": "string"
           }
       ],
       "creation_datetime": "number",
       "item_count": "number",
       "key_schema": [
           {
               "attribute_name": "string",
               "key_type": "string"
           }
       ],
       "local_secondary_indexes": [
           {
               "index_name": "string",
               "index_size_bytes": "number",
               "item_count": "number",
               "key_schema": [
                   {
                       "attribute_name": "string",
                       "key_type": "string"
                   }
               ],
               "projection": {
                   "non_key_attributes": [
                       "string"
                   ],
                   "projection_type": "string"
               }
           }
       ],
       "links": [
           {
               "href": "url",
               "rel": "self"
           }
       ],
       "table_size_bytes": "number",
       "table_status": "string"
   }
}
Response Elements

The following data is returned in JSON format by the service.

table_description
Represents the properties of a table.
Type: table_description object
Errors

TBW


ListTables

Returns an array of table describing info associated with the current user in given tenant.

URL

GET v1/{project_id}/data/tables

Request Syntax

This operation does not require a request body

Request Parameters

Parameters should be provided via GET query string.

start_table_name
The first table name that this operation will evaluate.
Type: xsd:string
Required: No
limit
A maximum number of the items to return.
Type: xsd:int
Required: No
Response Syntax
{
   "last_evaluated_table_name": "string",
   "tables": [
        {
            "rel": "string",
            "href": "url"
        }
   ]
}
Response Elements

The following data is returned in JSON format by the service.

last_evaluated_table_name
The name of the last table in the current page of results.
Type: String
tables
Array of the table info items
Type: array of structs
Errors

TBW