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    Documentation

Differences on Attribute and Event Columns


The difference is very simple: event columns are time-based and attribute columns are not.

Conceptual Differences

Before explaining further 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' %}

curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "UUID-01": {
            "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": {
            "name": "Michelle",
            "age": 32,
            "clicks": [
                {
                    "value": "Pay Now",
                    "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}"
                }
            ]
        },
        "UUID-03": {
            "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": ["table", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY', uses_test_endpoint=True)

insert_data = {
    "UUID-01": {
        "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": {
        "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": {
        "age": 32,
        "name": "Michelle",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "auto-create": [
        "table", 
        "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("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("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("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("table")
            .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" => {
        "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" => {
        "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" => {
        "age" => 32,
        "name" => "Michelle",
        "clicks" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value" => "Pay Now"
            }
        ]
    },
    "auto-create" => [
        "table", 
        "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": {
        "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": {
        "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": {
        "age": 32,
        "name": "Michelle",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "auto-create": [
        "table", 
        "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(
        "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(
        "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(
        "age" => 32,
        "name" => "Michelle",
        "clicks" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value" => "Pay Now"
            )
        )
    ),
    "auto-create" => array(
        "table", 
        "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>{
                    {"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>{
                    {"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>{
                    {"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>{
                    "table", 
                    "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{}{
            "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{}{
            "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{}{
            "age": 32,
            "name": "Michelle",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                    "value": "Pay Now",
                },
            },
        },
        "auto-create": []interface{}{
            "table",
            "column",
        },
    }

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

Suppose you have the 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 the 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 its values are not associated to a specific date/time.

  • Event Column is the 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.


Technical Difference

The technical differences between attribute columns and event columns is that the later allows you to perform time-based and frequency-based queries, by using the between and minfreq query parameters. Event columns are also used for the date histogram aggregations.

On SlicingDice you can define data retention time for the data stored on event columns, this way any data that is older than a specific time will be automatically deleted by the platform.


Commercial Difference

On SlicingDice you just pay based on how many attribute columns and event columns you need to store your data.

Attribute columns have a fixed price per month, but when it comes to event columns you have to consider how long you need the event data to be available for querying, as this data retention period will define the unitary cost for each event column you have.

Suppose you have the data as in the table above. As you can see, the Clicks column is storing event data, so in order to know how much the Clicks column will cost you monthly, you only need to decide for how long you want this clicks data to be available for querying: 30 days, 90 days, 180 days, or Forever.

Unlimited and Free Data Storage

Remember: the amount of data (values/rows) you insert for each column (attributes or events) will NOT impact on your monthly costs.


Differences on Attribute and Event Columns