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

Inserting on Event Columns


In order to insert values to event columns, you simply need to 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, their respective values and dates.

Event Columns insertions are a bit different from Attribute Columns, as they requires two parameters to be complete: value and date. A single event column is result of the combination of these two parameters (value and date).

The date component must follow the ISO 8601 format: YYYY-MM-DDThh:mm:ssTZ, e.g. {% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}, you can also use a date with milliseconds values, but they will be automatically discarded, e.g. 2017-06-01T10:35:23.954Z. You are able to configure a timezone by replacing TZ by +HH:MM or -HH:MM, e.g. {% convert_date 'YYYY-MM-DDT10:35:23+03:00' '-1d' %} or {% convert_date 'YYYY-MM-DDT10:35:23-07:00' '-1d' %}. Using Z is a shortcut to using UTC, such as in {% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}. However, it is important to know that SlicingDice will always store data in UTC format.

You may omit the date parameter when inserting data, leaving SlicingDice to use the current UTC timestamp, so you don't need to mind formatting the current datetime in your code. On the other hand, defining date gives you more control on the date being stored.

For the event columns it is necessary to define the data retention time, that determines for how long the event column's data remain available for querying.

Pro Tip

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

Consider generating a free demo database key for yourself to use in all examples below, as indicated on the try before you buy page.

Find below many data insertion examples on event columns, for all supported data types:

One column

Inserting one value to a string event column (page-view) to one entity (Entity1).

Entities
Page-view

Entity1

/online-demo - {% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}

$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "page-view": {
                "value": "/online-demo",
                "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}"
            }
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "page-view": {
            "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
            "value": "/online-demo"
        }
    },
    "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("Entity1", new JSONObject()
            .put("page-view", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}")
                .put("value", "/online-demo")))
        .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 = {
    "Entity1" => {
        "page-view" => {
            "date" => "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
            "value" => "/online-demo"
        }
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "page-view": {
            "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
            "value": "/online-demo"
        }
    },
    "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(
    "Entity1" => array(
        "page-view" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
            "value" => "/online-demo"
        )
    ),
    "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>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"page-view", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}"},
                        {"value", "/online-demo"}
                    }}
                }},
                {"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{}{
        "Entity1": map[string]interface{}{
            "page-view": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
                "value": "/online-demo",
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

One column, multiple events

Inserting two values to a string event column (page-view) to one entity (Entity1).

Entities
Page-view

Entity1

/online-demo - {% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}
/about - {% convert_date 'YYYY-MM-DDT10:42:17Z' '-1d' %}

$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "page-view": [
                {
                    "value": "/online-demo",
                    "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}"
                }, {
                    "value": "/about",
                    "date": "{% convert_date 'YYYY-MM-DDT10:42:17Z' '-1d' %}"
                }
            ]
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "page-view": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
                "value": "/online-demo"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:42:17Z' '-1d' %}",
                "value": "/about"
            }
        ]
    },
    "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("Entity1", new JSONObject()
            .put("page-view", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}")
                    .put("value", "/online-demo"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:42:17Z' '-1d' %}")
                    .put("value", "/about"))))
        .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 = {
    "Entity1" => {
        "page-view" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
                "value" => "/online-demo"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:42:17Z' '-1d' %}",
                "value" => "/about"
            }
        ]
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "page-view": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
                "value": "/online-demo"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:42:17Z' '-1d' %}",
                "value": "/about"
            }
        ]
    },
    "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(
    "Entity1" => array(
        "page-view" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
                "value" => "/online-demo"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:42:17Z' '-1d' %}",
                "value" => "/about"
            )
        )
    ),
    "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>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"page-view", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}"},
                            {"value", "/online-demo"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:42:17Z' '-1d' %}"},
                            {"value", "/about"}
                        }
                    }}
                }},
                {"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{}{
        "Entity1": map[string]interface{}{
            "page-view": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
                    "value": "/online-demo",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:42:17Z' '-1d' %}",
                    "value": "/about",
                },
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Multiple columns

Inserting values on two string event columns (page-view and clicks) to one entity (Entity1).

Entities
Page-view
Clicks

Entity1

/online-demo - {% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}

buy now button - {% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}

$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "page-view": {
                "value": "/online-demo",
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"
            },
            "clicks": {
                "value": "buy now button",
                "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}"
            }
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "page-view": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": "/online-demo"
        },
        "clicks": {
            "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
            "value": "buy now button"
        }
    },
    "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("Entity1", new JSONObject()
            .put("page-view", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}")
                .put("value", "/online-demo"))
            .put("clicks", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}")
                .put("value", "buy now button")))
        .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 = {
    "Entity1" => {
        "page-view" => {
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => "/online-demo"
        },
        "clicks" => {
            "date" => "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
            "value" => "buy now button"
        }
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "page-view": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": "/online-demo"
        },
        "clicks": {
            "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
            "value": "buy now button"
        }
    },
    "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(
    "Entity1" => array(
        "page-view" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => "/online-demo"
        ),
        "clicks" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
            "value" => "buy now button"
        )
    ),
    "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>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"page-view", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"},
                        {"value", "/online-demo"}
                    }},
                    {"clicks", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}"},
                        {"value", "buy now button"}
                    }}
                }},
                {"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{}{
        "Entity1": map[string]interface{}{
            "page-view": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
                "value": "/online-demo",
            },
            "clicks": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT10:35:23Z' '-1d' %}",
                "value": "buy now button",
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Multiple columns and entities

Inserting values on two string event columns (page-view and clicks) to two entities (Entity1 and Entity2).

Entities
Page-view
Clicks

Entity1

/online-demo - {% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}

Entity2

buy now button - {% convert_date 'YYYY-MM-DDT10:19:05Z' '-2d' %}

$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "page-view": {
                "value": "/online-demo",
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"
            }
        },
        "Entity2": {
            "clicks": {
                "value": "buy now button",
                "date": "{% convert_date 'YYYY-MM-DDT10:19:05Z' '-2d' %}"
            }
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "page-view": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": "/online-demo"
        }
    },
    "Entity2": {
        "clicks": {
            "date": "{% convert_date 'YYYY-MM-DDT10:19:05Z' '-2d' %}",
            "value": "buy now button"
        }
    },
    "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("Entity1", new JSONObject()
            .put("page-view", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}")
                .put("value", "/online-demo")))
        .put("Entity2", new JSONObject()
            .put("clicks", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT10:19:05Z' '-2d' %}")
                .put("value", "buy now button")))
        .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 = {
    "Entity1" => {
        "page-view" => {
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => "/online-demo"
        }
    },
    "Entity2" => {
        "clicks" => {
            "date" => "{% convert_date 'YYYY-MM-DDT10:19:05Z' '-2d' %}",
            "value" => "buy now button"
        }
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "page-view": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": "/online-demo"
        }
    },
    "Entity2": {
        "clicks": {
            "date": "{% convert_date 'YYYY-MM-DDT10:19:05Z' '-2d' %}",
            "value": "buy now button"
        }
    },
    "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(
    "Entity1" => array(
        "page-view" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => "/online-demo"
        )
    ),
    "Entity2" => array(
        "clicks" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT10:19:05Z' '-2d' %}",
            "value" => "buy now button"
        )
    ),
    "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>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"page-view", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"},
                        {"value", "/online-demo"}
                    }}
                }},
                {"Entity2", new Dictionary<string, dynamic>{
                    {"clicks", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT10:19:05Z' '-2d' %}"},
                        {"value", "buy now button"}
                    }}
                }},
                {"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{}{
        "Entity1": map[string]interface{}{
            "page-view": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
                "value": "/online-demo",
            },
        },
        "Entity2": map[string]interface{}{
            "clicks": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT10:19:05Z' '-2d' %}",
                "value": "buy now button",
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

String event columns

Inserting one value on a string column (page-view) to one entity (Entity1).

Entities
Page-view

Entity1

/online-demo - {% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}

$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "page-view": {
                "value": "/online-demo",
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"
            }
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "page-view": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": "/online-demo"
        }
    },
    "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("Entity1", new JSONObject()
            .put("page-view", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}")
                .put("value", "/online-demo")))
        .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 = {
    "Entity1" => {
        "page-view" => {
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => "/online-demo"
        }
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "page-view": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": "/online-demo"
        }
    },
    "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(
    "Entity1" => array(
        "page-view" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => "/online-demo"
        )
    ),
    "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>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"page-view", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"},
                        {"value", "/online-demo"}
                    }}
                }},
                {"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{}{
        "Entity1": map[string]interface{}{
            "page-view": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
                "value": "/online-demo",
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

String event columns limitations and restrictions:

  • String event values cannot have more than 1,000 characters.
  • String event date cannot be older than 12 years ago. So the earliest date allowed for today is: 2005-01-01.

Integer event columns

Inserting one value on an integer column (purchase-amount) to one entity (Entity1).

Entities
Purchase-amount

Entity1

129 - {% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}

$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "purchase-amount": {
                "value": 129,
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"
            }
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "purchase-amount": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": 129
        }
    },
    "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("Entity1", new JSONObject()
            .put("purchase-amount", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}")
                .put("value", 129)))
        .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 = {
    "Entity1" => {
        "purchase-amount" => {
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => 129
        }
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "purchase-amount": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": 129
        }
    },
    "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(
    "Entity1" => array(
        "purchase-amount" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => 129
        )
    ),
    "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>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"purchase-amount", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"},
                        {"value", 129}
                    }}
                }},
                {"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{}{
        "Entity1": map[string]interface{}{
            "purchase-amount": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
                "value": 129,
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Integer event columns limitations and restrictions:

  • Integer event values must be in the interval from -9,223,372,036,854,775,808 (-263) to 9,223,372,036,854,775,807 (263 - 1).
  • Integer event values cannot have decimal places.
  • Integer event date cannot be older than 12 years ago. So the earliest date allowed for today is: 2005-01-01.

Decimal event columns

Inserting one value on a decimal column (temperature) to one entity (Entity1).

Entities
Temperature

Entity1

27.943 - {% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}

$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "temperature": {
                "value": 27.943,
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"
            }
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "temperature": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": 27.943
        }
    },
    "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("Entity1", new JSONObject()
            .put("temperature", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}")
                .put("value", 27.943)))
        .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 = {
    "Entity1" => {
        "temperature" => {
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => 27.943
        }
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "temperature": {
            "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value": 27.943
        }
    },
    "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(
    "Entity1" => array(
        "temperature" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
            "value" => 27.943
        )
    ),
    "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>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"temperature", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}"},
                        {"value", 27.943}
                    }}
                }},
                {"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{}{
        "Entity1": map[string]interface{}{
            "temperature": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT09:25:19Z' '-1d' %}",
                "value": 27.943,
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Decimal event columns limitations and restrictions:

  • Decimal values must be in the interval from (-263/10p) to ((263 - 1)/10p) given p decimal places.
  • Decimal event values cannot have more than 20 decimal places.
  • Decimal event date cannot be older than 12 years ago. So the earliest date allowed for today is: 2005-01-01.

Automatic Column and Dimension creation

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


Inserting on Event Columns