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

How to insert data

First time checking our docs? You might want to start with the right foot by reading our Documentation Guide first.


Introduction

SlicingDice is very flexible in terms of data insertion, you can use our JDBC and ODBC SQL Drivers, our API-based SQL endpoint or our standard API-based JSON endpoint.


Entities

Before we start inserting data, let's quickly review the concept of entity, that is necessary to insert data to your SlicingDice database.

An entity is basically to "whom" the data that will be associated and stored on a database.

An entity is like a primary key . SlicingDice uses the entities to associate any data inserted on the database, that could be an user's email address, a device identification number, a server's hostname, etc.

To make things clear, take a look at the data table below. As you can see, there are three columns, Name, Age and Clicks, and its values are associated to the corresponding User IDs, UUID-01, UUID-02 and UUID-03. These User IDs are the Entity ID for whom the data was inserted.

User ID
Name
Age
Clicks

UUID-01

Jeff

25

Add to Cart - {% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}
Pay Now - {% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}
Support - {% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}

UUID-02

Michelle

32

Add to Cart - {% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}
Support - {% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}

UUID-03

Lerry

47

Add to Cart - {% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}
Pay Now - {% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}

Every entity must have an unique identifier, a string that uniquely identifies it. For instance, your users' email address, MAC Address or your server hostname are perfect as unique entity IDs.

When you create a database or a dimension, SlicingDice automatically creates an Unique ID column type called Entity ID (with API name entity-id) for that dimension. This column will be transparently used by SlicingDice to store the value of all the entities you insert on the dimension. It's not possible to delete this column.


Inserting data

In order to insert values to columns and entities, you only need to write an INSERT command on SQL or, if you prefer to use our JSON API, send a POST request to https://api.slicingdice.com/v1/insert with a JSON object where the key is the entity ID containing JSON objects with column names and their respective values.

Below is an insertion example to one entity (UUID-01), using three columns, which two of them are attribute columns (Name and Age) and one is an event column (Clicks).

Entities
Name
Age
Clicks

UUID-01

Jeff

25

Add to Cart - {% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}
Pay Now - {% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}
Support - {% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}

INSERT INTO users ([entity-id], [clicks.0.value], [clicks.0.date], [clicks.1.value], [clicks.1.date], [clicks.2.value], [clicks.2.date], name, age) VALUES ("UUID-01", "Add to Cart", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}", "Pay Now", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}", "Support", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}", "Jeff", 25);
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO users ([entity-id], [clicks.0.value], [clicks.0.date], [clicks.1.value], [clicks.1.date], [clicks.2.value], [clicks.2.date], name, age) VALUES ("UUID-01", "Add to Cart", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}", "Pay Now", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}", "Support", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}", "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,
            "clicks": [
                {
                    "value": "Add to Cart",
                    "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}"
                }, {
                    "value": "Pay Now",
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}"
                }, {
                    "value": "Support",
                    "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}"
                }
            ]
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY', uses_test_endpoint=True)

insert_data = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value": "Add to Cart"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value": "Pay Now"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value": "Support"
            }
        ]
    },
    "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", true);

        JSONObject insertData = new JSONObject()
        .put("UUID-01", new JSONObject()
            .put("dimension", "users")
            .put("age", 25)
            .put("name", "Jeff")
            .put("clicks", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}")
                    .put("value", "Add to Cart"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}")
                    .put("value", "Pay Now"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}")
                    .put("value", "Support"))))
        .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', uses_test_endpoint: true)

insert_data = {
    "UUID-01" => {
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value" => "Add to Cart"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value" => "Pay Now"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value" => "Support"
            }
        ]
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value": "Add to Cart"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value": "Pay Now"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value": "Support"
            }
        ]
    },
    "auto-create": [
        "dimension", 
        "column"
    ]
};

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

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

$insertData = array(
    "UUID-01" => array(
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value" => "Add to Cart"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value" => "Pay Now"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value" => "Support"
            )
        )
    ),
    "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", usesTestEndpoint: true);

            var insertData = new Dictionary<string, dynamic>{
                {"UUID-01", new Dictionary<string, dynamic>{
                    {"dimension", "users"},
                    {"age", 25},
                    {"name", "Jeff"},
                    {"clicks", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}"},
                            {"value", "Add to Cart"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}"},
                            {"value", "Pay Now"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}"},
                            {"value", "Support"}
                        }
                    }}
                }},
                {"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)
    slicingdice.Test = true

    insertData := map[string]interface{}{
        "UUID-01": map[string]interface{}{
            "dimension": "users",
            "age": 25,
            "name": "Jeff",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                    "value": "Add to Cart",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                    "value": "Pay Now",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                    "value": "Support",
                },
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

If you are using the SlicingDice API to insert your data (not our JDBC or ODBC SQL Drivers), after making an insertion request like this above, the API response will be in the format below:

{
    "status": "success",
    "inserted-entities": 1,
    "inserted-values": 5,
    "took": 0.014
}

Let's understand each component of the message:

  • status - Indicating whether the request was successfully processed or not.
  • inserted-entities - Total number of entities inserted for the given request.
  • inserted-values - Total number of values inserted, summing up from all entities, for the given request.
  • took - Time spent processing this request, in seconds.

Once SlicingDice receives your insertion request, it can take up to a few seconds for your data to be available for querying due to our eventual consistency model.

Pro Tip

Remember that you can also use test databases to make data insertions and queries before inserting real data to your production database.

Important

By default, all data inserted to SlicingDice is stored in lowercase only. Therefore, SlicingDice should not store data that must be case sensitive, such as passwords.


Attribute and Event Columns

Before explaining the difference between attribute and event columns, as data and code is worth more than 1,000 words, please take a look on this data table below:

User ID
Name
Age
Clicks

UUID-01

Jeff

25

Add to Cart - {% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}
Pay Now - {% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}
Support - {% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}

UUID-02

Michelle

32

Pay Now - {% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}

UUID-03

Lerry

47

Support - {% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}
Pay Now - {% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}

INSERT INTO users ([entity-id], [clicks.0.value], [clicks.0.date], [clicks.1.value], [clicks.1.date], [clicks.2.value], [clicks.2.date], name, age) VALUES ("UUID-01", "Add to Cart", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}", "Pay Now", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}", "Support", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}", "Jeff", 25);
INSERT INTO users ([entity-id], [clicks.0.value], [clicks.0.date], name, age) VALUES ("UUID-02", "Pay Now", "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}", "Michelle", 32);
INSERT INTO users ([entity-id], [clicks.0.value], [clicks.0.date], [clicks.1.value], [clicks.1.date], name, age) VALUES ("UUID-03", "Support", "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}", "Pay Now", "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}", "Lerry", 47);
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO users ([entity-id], [clicks.0.value], [clicks.0.date], [clicks.1.value], [clicks.1.date], [clicks.2.value], [clicks.2.date], name, age) VALUES ("UUID-01", "Add to Cart", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}", "Pay Now", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}", "Support", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}", "Jeff", 25); INSERT INTO users ([entity-id], [clicks.0.value], [clicks.0.date], name, age) VALUES ("UUID-02", "Pay Now", "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}", "Michelle", 32); INSERT INTO users ([entity-id], [clicks.0.value], [clicks.0.date], [clicks.1.value], [clicks.1.date], name, age) VALUES ("UUID-03", "Support", "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}", "Pay Now", "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}", "Lerry", 47);'
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,
            "clicks": [
                {
                    "value": "Add to Cart",
                    "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}"
                }, {
                    "value": "Pay Now",
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}"
                }, {
                    "value": "Support",
                    "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}"
                }
            ],
        },
        "UUID-02": {
            "dimension": "users",
            "name": "Michelle",
            "age": 32,
            "clicks": [
                {
                    "value": "Pay Now",
                    "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}"
                }
            ]
        },
        "UUID-03": {
            "dimension": "users",
            "name": "Lerry",
            "age": 47,
            "clicks": [
                {
                    "value": "Support",
                    "date": "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}"
                }, {
                    "value": "Pay Now",
                    "date": "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}"
                }
            ]
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY', uses_test_endpoint=True)

insert_data = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value": "Add to Cart"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value": "Pay Now"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value": "Support"
            }
        ]
    },
    "UUID-03": {
        "dimension": "users",
        "age": 47,
        "name": "Lerry",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                "value": "Support"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "UUID-02": {
        "dimension": "users",
        "age": 32,
        "name": "Michelle",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "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", true);

        JSONObject insertData = new JSONObject()
        .put("UUID-01", new JSONObject()
            .put("dimension", "users")
            .put("age", 25)
            .put("name", "Jeff")
            .put("clicks", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}")
                    .put("value", "Add to Cart"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}")
                    .put("value", "Pay Now"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}")
                    .put("value", "Support"))))
        .put("UUID-03", new JSONObject()
            .put("dimension", "users")
            .put("age", 47)
            .put("name", "Lerry")
            .put("clicks", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}")
                    .put("value", "Support"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}")
                    .put("value", "Pay Now"))))
        .put("UUID-02", new JSONObject()
            .put("dimension", "users")
            .put("age", 32)
            .put("name", "Michelle")
            .put("clicks", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}")
                    .put("value", "Pay Now"))))
        .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', uses_test_endpoint: true)

insert_data = {
    "UUID-01" => {
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value" => "Add to Cart"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value" => "Pay Now"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value" => "Support"
            }
        ]
    },
    "UUID-03" => {
        "dimension" => "users",
        "age" => 47,
        "name" => "Lerry",
        "clicks" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                "value" => "Support"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                "value" => "Pay Now"
            }
        ]
    },
    "UUID-02" => {
        "dimension" => "users",
        "age" => 32,
        "name" => "Michelle",
        "clicks" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value" => "Pay Now"
            }
        ]
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value": "Add to Cart"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value": "Pay Now"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value": "Support"
            }
        ]
    },
    "UUID-03": {
        "dimension": "users",
        "age": 47,
        "name": "Lerry",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                "value": "Support"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "UUID-02": {
        "dimension": "users",
        "age": 32,
        "name": "Michelle",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "auto-create": [
        "dimension", 
        "column"
    ]
};

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

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

$insertData = array(
    "UUID-01" => array(
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value" => "Add to Cart"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value" => "Pay Now"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value" => "Support"
            )
        )
    ),
    "UUID-03" => array(
        "dimension" => "users",
        "age" => 47,
        "name" => "Lerry",
        "clicks" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                "value" => "Support"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                "value" => "Pay Now"
            )
        )
    ),
    "UUID-02" => array(
        "dimension" => "users",
        "age" => 32,
        "name" => "Michelle",
        "clicks" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value" => "Pay Now"
            )
        )
    ),
    "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", usesTestEndpoint: true);

            var insertData = new Dictionary<string, dynamic>{
                {"UUID-01", new Dictionary<string, dynamic>{
                    {"dimension", "users"},
                    {"age", 25},
                    {"name", "Jeff"},
                    {"clicks", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}"},
                            {"value", "Add to Cart"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}"},
                            {"value", "Pay Now"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}"},
                            {"value", "Support"}
                        }
                    }}
                }},
                {"UUID-03", new Dictionary<string, dynamic>{
                    {"dimension", "users"},
                    {"age", 47},
                    {"name", "Lerry"},
                    {"clicks", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}"},
                            {"value", "Support"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}"},
                            {"value", "Pay Now"}
                        }
                    }}
                }},
                {"UUID-02", new Dictionary<string, dynamic>{
                    {"dimension", "users"},
                    {"age", 32},
                    {"name", "Michelle"},
                    {"clicks", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}"},
                            {"value", "Pay Now"}
                        }
                    }}
                }},
                {"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)
    slicingdice.Test = true

    insertData := map[string]interface{}{
        "UUID-01": map[string]interface{}{
            "dimension": "users",
            "age": 25,
            "name": "Jeff",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                    "value": "Add to Cart",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                    "value": "Pay Now",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                    "value": "Support",
                },
            },
        },
        "UUID-03": map[string]interface{}{
            "dimension": "users",
            "age": 47,
            "name": "Lerry",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                    "value": "Support",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                    "value": "Pay Now",
                },
            },
        },
        "UUID-02": map[string]interface{}{
            "dimension": "users",
            "age": 32,
            "name": "Michelle",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                    "value": "Pay Now",
                },
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Suppose you have this data above. As you can see, the Clicks column is storing event data, and the other columns are storing attributes, like Name and Age.

That's basically the difference between Attribute Columns and Event Columns:

  • Attribute Column is a column type used to store any data not associated to a date/time. Example: storing the value Jeff for the Name column and the value 25 for the Age column. In this case both columns and their values are not associated to a specific date/time.

  • Event Column is column type used to store data that is associated to a date/time. Example: storing the value Add to Cart on the date/time {% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %} for the Click event column. In this case it's important to know when the Add to Cart event happened.

Check the docs for a detailed comparison on attribute and event columns.

Unlimited and Free Data Storage

Remember: If you select the Pay-per-column pricing model for your database, the amount of data (values/rows) you insert for each column (attributes or events) will NOT impact on your monthly costs.


Automatic Column and Dimension creation

By using the "auto-create": ["dimension", "column"] parameter when inserting data, SlicingDice will automatically create columns and dimensions that do not exist yet.
Check the docs on how to create columns for more details.


How to insert data

First time checking our docs? You might want to start with the right foot by reading our Documentation Guide first.