Skip to the content.

Create Table [/create-table]

Create Table [POST]

Creates Cassandra Table.

Accepted parameters:

Reference Datastax.

Shell snippets

curl --request POST \
    --url http://localhost:5000/create-table \
    --header 'content-type: application/json' \
    --data '{
        "keyspace": "examples_bis",
        "tablename": "older_than_40_summarized",
        "columns": [
            {
                "db_field": "age",
                "db_type": "integer",
                "primary_key": "true"
            }, 
            {
                "db_field": "total",
                "db_type": "Integer" 
            }
        ]
    }'

Response

// Response 201 OK
{
    "success": true,
    "data": null,
    "columns": [
        {
            "db_field": "age",
            "db_type": "integer",
            "primary_key": "true"
        },
        {
            "db_field": "total",
            "db_type": "Integer"
        }
    ],
    "status": 201,
    "tablename": "older_than_40_summarized",
    "keyspace": "examples_bis"
}
    curl --request POST \
      --url http://localhost:5000/create-table \
      --header 'content-type: application/json' \
      --data '{
        "keyspace": "examples",
        "tablename": "test_2",
        "columns": [
            {
                "db_field": "field_1",
                "db_type": "uuid",
                "primary_key": "true"
            },
            {
                "db_field": "field_2",
                "db_type": "counter"
            }
        ]
    }'    

Response

{
    // Response 201 OK
    "tablename": "test",
    "status": 201,
    "success": true,
    "keyspace": "examples",
    "data": null,
    "columns": [
        {
            "db_type": "text",
            "db_field": "field_1"
        },
        {
            "db_type": "integer",
            "db_field": "field_2",
            "primary_key": "true"
        }
    ]
}