SlicingDice Documentation

SlicingDice - The All-in-One Solution Documentation

Welcome to the SlicingDice documentation. You'll find comprehensive guides and documentation to help you start working with SlicingDice as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Guides

3. Database Creation, Update & Deletion

On this page, we present how to create, update and delete databases using the API, although it's also possible to create and delete databases using the Control Panel.

Different from most of the API endpoints, the database creations and deletions uses the Team Key, not the Database Key. You can read more about the Team Key on this page.

Creating a database using the /database endpoint

You can create a database through the POST /database API endpoint. To create a database you'll just need to create command like the following example:

curl -X POST https://api.slicingdice.com/v1/database \
    -H 'Authorization: TEAM_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
    	"database": {
      		"name": "UsersDB",
      		"description": "Database to store users data",
      		"type": "test",
      		"pricing-model": "pay-per-column",
      		"labels": ["financialdb", "technicaldb"],
      		"query-load": "normal",
      		"insertion-load": "high"
    		},
    	"addresses-whitelist": ["192.168.0.1", "192.168.0.2"]
}'

Request parameters

The following parameters apply to the database creation request:

  • database (required)
    The database parameter will contain the basic configuration of your database like name, description, is-test, pricing-model, query-load and insertion-load that will be explained below.

  • name (required)
    Defines the database name as it'll show in control panel, up to 64 characters. All ASCII characters are allowed, except ', " and

  • description (optional)
    Describes what this database is about. Useful when the name may introduce ambiguity.

  • type (required)
    Defines if this database will be a test database (free of charges but your data will be deleted after 7 days) or an official production database.

  • pricing-model (required)
    This parameter defines what will be the pricing model for your production database. You can choose between "pay-per-column" or "pay-per-gigabyte" model. Before choosing the best option for you, read more about our pricing models.
    The pricing model parameter is ignored if you are creating a test database

  • labels (optional)
    Possible labels to attach to this database.

  • query-load (required)
    The query load defines the quantity of queries requests that you'll be limited to execute per minute. You can choose:

    • Normal - Up to 60 Queries Per Minute
    • High - Up to 300 Queries Per Minute
    • Ultra - Up to 600 Queries Per Minute
    • Mega - Up to 6000 Queries Per Minute
  • insertion-load (required)
    The insertion load defines the number of insertions (rows) that you'll be limited to execute per minute. You can choose:

    • Normal - up to 1 million Insertions (and Updates) per Day
    • High - up to 10 million Insertions (and Updates) per Day
    • Ultra - up to 50 million Insertions (and Updates) per Day
    • Mega - up to 100 million Insertions (and Updates) per Day
  • addresses-whitelist (optional)
    This parameter defines a list of IP addresses or website domains that can use this custom key to access a database.

Request response to database creation

The column creation POST request above will result in this response below:

{
    "status": "success",
    "database-name": [
        "UserDB"
    ]
}

Response elements:

  • status - Request status, informing whether it was successful or not.
  • name - The name of the created database.

Updating a database using the /database endpoint

You can update a database through the PUT /database API endpoint. To update a database you just need to create a command like the following example:

curl -X PUT https://api.slicingdice.com/v1/database \
    -H 'Authorization: TEAM_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
    	"database": {
      		"name": "UsersDB",
          "new-database-name": "NewUserDB",
      		"description": "Database to store users data",
      		"type": "test",
      		"pricing-model": "pay-per-column",
      		"labels": ["financialdb", "technicaldb"]
      		"query-load": "normal",
      		"insertion-load": "high"
    		},
    	"addresses-whitelist": ["192.168.0.1", "192.168.0.2"]
}'

Deleting a database using /database endpoint

You can delete a database through the /database API endpoint. You can do it providing the database name in your request, such as the following example:

curl -X DELETE https://api.slicingdice.com/v1/database \
    -H 'Authorization: TEAM_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
         "database": {
        		"name": "UsersDB"
    		}
      }'

Request parameters

The following parameters apply to the database creation request:

  • database (required)
    Contain the name parameter of the database that will be deleted.

  • name (required)
    Database name that will be deleted from your account. It should be a valid database name (this database must exist in your account)

Prevent Database Deletion

For security reasons, you can configure the Team Key to do not allow database deletion using the API, on the Control Panel.