SlicingDice Documentation

SlicingDice API Docs

Welcome to the SlicingDice API 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

Inserting on different dimensions


The concept of a dimension on SlicingDice is a bit different than on relational databases.

On SlicingDice dimensions are used when you want to store the same data (or very similar), but associating it to different entity ids. A different way to think about it is if you want to store your data, but in different "dimensions", for example: storing browsing behavior data for a user dimension and a web pages dimension.

Default Dimension

If you don't add any dimension when creating a new database, SlicingDice automatically creates a default dimension for you to store data.

If you do not specify the dimension parameter on your request, either insertion or query, under the hood SlicingDice is always using the default dimension.

You can read more about it accessing the how to create dimension documentation page.

Dimension usage example

See below the similarity of SQL dimension selection and the SlicingDice JSON, when inserting data.

SQL equivalent
SlicingDice "dimension" parameter (JSON)

Insertion example

INSERT INTO default_table
(entity-id, name, age)
VALUES
('UUID-01', 'Jeff', 25);

Insertion example

{
    "UUID-01": {
        "dimension": "default",
        "name": "Jeff",
        "age": 25
    }
}

Insertion request for a single dimension

As you can see below, we are making a single request inserting data on the users dimension.

INSERT INTO users ([entity-id], name, age) VALUES("UUID-01", "Jeff", 25);
$ curl -X POST https://api.slicingdice.com/v1/test/sql \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO users ([entity-id], name, age) VALUES("UUID-01", "Jeff", 25);'
curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "UUID-01": {
            "dimension": "users",
            "name": "Jeff",
            "age": 25
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff"
    },
    "auto-create": [
        "dimension", 
        "column"
    ]
}

print(slicingdice.insert(insert_data))

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 insertData = new JSONObject()
        .put("UUID-01", new JSONObject()
            .put("dimension", "users")
            .put("age", 25)
            .put("name", "Jeff"))
        .put("auto-create", new JSONArray()
            .put("dimension")
            .put("column"));

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

insert_data = {
    "UUID-01" => {
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff"
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff"
    },
    "auto-create": [
        "dimension", 
        "column"
    ]
};

slicingdice.insert(insertData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});

<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$insertData = array(
    "UUID-01" => array(
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff"
    ),
    "auto-create" => array(
        "dimension", 
        "column"
    )
);

print_r($slicingdice->insert($insertData));
?>
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 insertData = new Dictionary<string, dynamic>{
                {"UUID-01", new Dictionary<string, dynamic>{
                    {"dimension", "users"},
                    {"age", 25},
                    {"name", "Jeff"}
                }},
                {"auto-create", new List<dynamic>{
                    "dimension", 
                    "column"
                }}
            };

            var result = slicingdice.Insert(insertData);
            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)

    insertData := map[string]interface{}{
        "UUID-01": map[string]interface{}{
            "dimension": "users",
            "age": 25,
            "name": "Jeff",
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

    fmt.Println(slicingdice.Insert(insertData))
}

Insertion request for two dimensions

As you can see below, we are making a single request inserting data on two dimensions, the users and the page dimension.

INSERT INTO users ([entity-id], name, age) VALUES("UUID-01", "Jeff", 25);
INSERT INTO page ([entity-id], users, referer) VALUES("/online-demo", "UUID-01", "google");
$ curl -X POST https://api.slicingdice.com/v1/test/sql \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO users ([entity-id], name, age) VALUES("UUID-01", "Jeff", 25); INSERT INTO page ([entity-id], users, referer) VALUES("/online-demo", "UUID-01", "google");'
curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "UUID-01": {
            "dimension": "users",
            "name": "Jeff",
            "age": 25
        },
        "/online-demo": {
            "dimension": "page",
            "users": "UUID-01",
            "referer": "google"
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff"
    },
    "auto-create": [
        "dimension", 
        "column"
    ],
    "/online-demo": {
        "dimension": "page",
        "referer": "google",
        "users": "UUID-01"
    }
}

print(slicingdice.insert(insert_data))

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 insertData = new JSONObject()
        .put("UUID-01", new JSONObject()
            .put("dimension", "users")
            .put("age", 25)
            .put("name", "Jeff"))
        .put("auto-create", new JSONArray()
            .put("dimension")
            .put("column"))
        .put("/online-demo", new JSONObject()
            .put("dimension", "page")
            .put("referer", "google")
            .put("users", "UUID-01"));

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

insert_data = {
    "UUID-01" => {
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff"
    },
    "auto-create" => [
        "dimension", 
        "column"
    ],
    "/online-demo" => {
        "dimension" => "page",
        "referer" => "google",
        "users" => "UUID-01"
    }
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff"
    },
    "auto-create": [
        "dimension", 
        "column"
    ],
    "/online-demo": {
        "dimension": "page",
        "referer": "google",
        "users": "UUID-01"
    }
};

slicingdice.insert(insertData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});

<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$insertData = array(
    "UUID-01" => array(
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff"
    ),
    "auto-create" => array(
        "dimension", 
        "column"
    ),
    "/online-demo" => array(
        "dimension" => "page",
        "referer" => "google",
        "users" => "UUID-01"
    )
);

print_r($slicingdice->insert($insertData));
?>
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 insertData = new Dictionary<string, dynamic>{
                {"UUID-01", new Dictionary<string, dynamic>{
                    {"dimension", "users"},
                    {"age", 25},
                    {"name", "Jeff"}
                }},
                {"auto-create", new List<dynamic>{
                    "dimension", 
                    "column"
                }},
                {"/online-demo", new Dictionary<string, dynamic>{
                    {"dimension", "page"},
                    {"referer", "google"},
                    {"users", "UUID-01"}
                }}
            };

            var result = slicingdice.Insert(insertData);
            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)

    insertData := map[string]interface{}{
        "UUID-01": map[string]interface{}{
            "dimension": "users",
            "age": 25,
            "name": "Jeff",
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
        "/online-demo": map[string]interface{}{
            "dimension": "page",
            "referer": "google",
            "users": "UUID-01",
        },
    }

    fmt.Println(slicingdice.Insert(insertData))
}