CreateTable

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:

table_name
The name of the table. Unique per project.
Type: string
Required: Yes
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

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

Sample Request

{
    "attribute_definitions": [
        {
            "attribute_name": "ForumName",
            "attribute_type": "S"
        },
        {
            "attribute_name": "Subject",
            "attribute_type": "S"
        },
        {
            "attribute_name": "LastPostDateTime",
            "attribute_type": "S"
        }
    ],
    "table_name": "Thread",
    "key_schema": [
        {
            "attribute_name": "ForumName",
            "key_type": "HASH"
        },
        {
            "attribute_name": "Subject",
            "key_type": "RANGE"
        }
    ],
    "local_secondary_indexes": [
        {
            "index_name": "LastPostIndex",
            "key_schema": [
                {
                    "attribute_name": "ForumName",
                    "key_type": "HASH"
                },
                {
                    "attribute_name": "LastPostDateTime",
                    "key_type": "RANGE"
                }
            ],
            "projection": {
                "projection_type": "KEYS_ONLY"
            }
        }
    ]
}

Sample Response

{
    "table_description": {
        "attribute_definitions": [
            {
                "attribute_name": "Subject",
                "attribute_type": "S"
            },
            {
                "attribute_name": "LastPostDateTime",
                "attribute_type": "S"
            },
            {
                "attribute_name": "ForumName",
                "attribute_type": "S"
            }
        ],
        "creation_date_time": 0,
        "item_count": 0,
        "key_schema": [
            {
                "attribute_name": "ForumName",
                "key_type": "HASH"
            },
            {
                "attribute_name": "Subject",
                "key_type": "RANGE"
            }
        ],
        "local_secondary_indexes": [
            {
                "index_name": "LastPostIndex",
                "index_size_bytes": 0,
                "item_count": 0,
                "key_schema": [
                    {
                        "attribute_name": "ForumName",
                        "key_type": "HASH"
                    },
                    {
                        "attribute_name": "LastPostDateTime",
                        "key_type": "RANGE"
                    }
                ],
                "projection": {
                    "projection_type": "ALL"
                }
            }
        ],
        "table_name": "Thread",
        "table_size_bytes": 0,
        "table_status": "ACTIVE",
        "links": [
            {
                "href": "http://localhost:8480/v1/fake_project_id/data/tables/Thread",
                "rel": "self"
            },
            {
                "href": "http://localhost:8480/v1/fake_project_id/data/tables/Thread",
                "rel": "bookmark"
            }
        ]
    }
}