Managing Databases

You'll be presented the API commands to create, update, delete or list databases.


Creating Databases

You can create one database per request through a POST request on the /database endpoint authenticated with a Team Key.

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",
          	"cloud_provider": "ovh",
          	"cloud_area": "global"
    		},
    	"addresses-whitelist": ["192.168.0.1", "192.168.0.2"]
}'
Request Parameters
Parameter Mandatory Description
database Yes Contain the basic configuration of the database.
name Yes Database name as it'll show in control panel, up to 64 characters. All ASCII characters are allowed, except ', " and _
description No Database description
type Yes Defines if it's a test or a paid production database.
pricing-model Yes Defines the adopted pricing model. It can be "pay-per-column", "pay-per-gigabyte" or "smart-pricing". The pricing model parameter is ignored if you are creating a test database
labels No Labels to attach to this database.
query-load Yes 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 Yes Defines the number of insertions (rows) that you'll be limited to execute per minute. You can choose:
  • "normal" - up to 10 million Insertions/Updates per Day
  • "high" - up to 100 million Insertions/Updates per Day
  • "ultra" - up to 500 million Insertions/Updates per Day
  • "mega" - up to 1 billion Insertions/Updates per Day
cloud_provider No The cloud where the database will be stored. The default is "ovh".
cloud_area No The cloud area where the database will be stored. The default is "global".
addresses-whitelist No A list of IP addresses or website domains that can access this database.
Request Response
{
    "status": "success",
    "database-name": [
        "UserDB"
    ]
}

Updating a database

You can update one database configuration per request through a PUT request on the /database endpoint authenticated with a Team Key.

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"]
}'
Request Parameters
Parameter Mandatory Description
database Yes Contain the basic configuration of the updated database.
name Yes Name of an existent database.
new-database-name No New database name as it'll show in control panel, up to 64 characters. All ASCII characters are allowed, except ', " and _
description No New database description
type No Defines if it's a test or a paid production database.
pricing-model No Defines the adopted pricing model. It can be "pay-per-column", "pay-per-gigabyte" or "smart-pricing". The pricing model parameter is ignored if you are creating a test database
labels No Labels to attach to this database.
query-load No 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 No Defines the number of insertions (rows) that you'll be limited to execute per minute. You can choose:
  • "normal" - up to 10 million Insertions/Updates per Day
  • "high" - up to 100 million Insertions/Updates per Day
  • "ultra" - up to 500 million Insertions/Updates per Day
  • "mega" - up to 1 billion Insertions/Updates per Day
addresses-whitelist No A list of IP addresses or website domains that can access this database.
Request Response
{
    "status": "success",
    "database-name": [
        "UserDB"
    ]
}

Deleting Databases

You can delete one database per request through a DELETE request on the /database endpoint authenticated with a Team Key.

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
Parameter Mandatory Description
name Yes Name of an existent database to be deleted.
Request Response
{
    "status": "success",
    "database-name": [
        "UserDB"
    ]
}

Listing databases

You can retrieve information about a specific database (related to a given Database Key) or about all existent databases (with the Team Key), using the API.

Specific database

You can retrieve information about a specific database through a GET request on the /database endpoint authenticated with a Database Key.

curl -X GET https://api.slicingdice.com/v1/database \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json'
from pyslicer import SlicingDice
import asyncio
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

loop = asyncio.get_event_loop()
print(loop.run_until_complete(slicingdice.get_database()))
import com.slicingdice.jslicer.SlicingDice;
import java.io.IOException;
import org.json.JSONObject;
import org.json.JSONArray;

public class Example {
    public static void main(String[] args) throws IOException {
        SlicingDice slicingdice = new SlicingDice("MASTER_API_KEY");

        JSONObject result = slicingdice.getDatabase();
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

puts slicingdice.get_database()
const SlicingDice = require('slicerjs');

const slicingdice = new SlicingDice({masterKey: 'MASTER_API_KEY'});

slicingdice.getDatabase().then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;

$slicingdice = new SlicingDice(array("masterKey" =>> "MASTER_API_KEY"));

print_r($slicingdice->getDatabase());
?>
using System.Collections.Generic;
using Slicer;
using Newtonsoft.Json;

namespace SlicerTester.Console
{
    class Program
    {
        static void Main(string[] args)
        {
            var slicingdice = new SlicingDice(masterKey: "MASTER_API_KEY");

            var result = slicingdice.GetDatabase();
            System.Console.WriteLine(JsonConvert.SerializeObject(result).ToString());
        }
    }
}
package main
import (
    "fmt"
    "github.com/SlicingDice/slicingdice-go/slicingdice"
)
func main() {
    keys := new(slicingdice.APIKey)
    keys.MasterKey = "MASTER_API_KEY"
    slicingdice := slicingdice.New(keys, 60)

    fmt.Println(slicingdice.GetDatabase())
}
Request Response
{
    "name": "Test 1",
    "description": "Test Database",
    "dimensions": [
        "default",
        "users"
    ],
    "updated-at": "2017-05-19T14:27:47.417415",
    "created-at": "2017-05-12T02:23:34.231418"
}

All existent databases

You can retrieve information about all databases of a team through a GET request on the /database/retrieve_all endpoint authenticated with a Team Key.

curl -X GET https://api.slicingdice.com/v1/database/retrieve_all \
    -H 'Authorization: TEAM_API_KEY' \
    -H 'Content-Type: application/json'
Request Response
[
{
    "name": "Test 1",
    "description": "Test Database 1",
    "dimensions": [
        "default",
        "users"
    ],
    "updated-at": "2018-05-19T14:27:47.417415",
    "created-at": "2018-05-12T02:23:34.231418"
},
{
    "name": "Test 2",
    "description": "Test Database 2",
    "dimensions": [
        "default",
        "products",
      	"revenue"
    ],
    "updated-at": "2018-08-26T18:01:38.317815",
    "created-at": "2018-08-20T23:48:12.111619"
}
]

Cloud providers and areas

SlicingDice can be stored in many cloud platforms. We run the instance in the cloud providers and only in areas that have at least 3 availability zones.
Below is a table that shows the cloud provider's and its available cloud areas to be used on the database related requests.

Cloud Provider API cloud_provider API cloud_area
Alibaba Cloud alibaba-cloud cn-beijing (Beijing, China)
cn-hangzhou (Hangzhou, China)
cn-shanghai (Shanghai, China)
cn-shenzhen (Shenzhen, China)
ap-southeast-1 (Singapore)
Google Cloud google-cloud asia-east1 (Changhua, Taiwan)
asia-east2 (Hong Kong)
asia-northeast1 (Tokyo, Japan)
asia-south1 (Mumbai, India)
asia-southeast1 (Juron West, Singapore)
australia-southeast1 (Sydney, Australia)
europe-north1 (Hamina, Finland)
europe-west1 (St. Ghislain, Belgium)
europe-west2 (London, England)
europe-west3 (Frankfurt, Germany)
europe-west4 (Eemshaven, Netherlands)
northamerica-northeast1 (Montreál, Canada)
southamerica-east1 (São Paulo, Brazil)
us-central1 (Council Bluffs, Iowa, USA)
us-east1 (Moncks Corner, South Carolina, USA)
us-east4 (Ashburn, Northern Virginia, USA)
us-west1 (The Dalles, Oregon, USA)
us-west2 (Los Angeles, California, USA)
Amazon Web Services aws us-east1 (North Virginia, USA)
us-east2 (Ohio, USA)
us-west1 (North California, USA)
us-west2 (Oregon, USA)
ap-southeast-1 (Singapore)
ap-southeast-2 (Sydney, Australia)
ap-northeast-1 (Tokyo, Japan)
eu-central-1 (Frankfurt, Germany)
eu-west-1 (Ireland)
eu-west-2 (London, England)
eu-west-3 (Paris, France)
eu-north-1 (Stockholm, Sweden)
sa-east-1 (São Paulo, Brazil)
Microsoft Azure azure us-central (Iowa, USA)
us-east2 (Virginia, USA)
fr-central (Paris, France)
eu-north (Ireland)
ap-southeast-1
eu-west (Netherlands)
us-west2 (Washington, USA)
OVH ovh global (Canada, Germany, and France)