Insertions

You'll be presented the API commands to insert data on SlicingDice for all supported data types.


Insertion Limits

Below is the list of limits and restrictions for the /insert endpoint that accepts HTTPS and HTTP POST requests:

Operation Limits
Request Limit At most 1,000 entity IDs or 5,000 columns per request.
Request Size Cannot exceed 5 MB
Boolean Values Must be True or False
String Values Values for unique-id, string and string-event columns can have at most 1,000 characters and are only stored in lowercase.
Integer Values Values for integer and integer-event columns must be in the interval from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
Decimal Values Values for decimal and decimal-event columns must be in the interval from (-263/10p) to ((263 - 1)/10p) given p decimal place and cannot have more than 20 decimal places.
Date Values Values for date column must be in YYYY-MM-DD format.
Datetime Values Values for datetime column must be in YYYY-MM-DDTHH:MM:SSZ format.
Geolocation Values Values for geolocation columns must be in an interval of [-180, 180] for longitude and [-90,90] for latitude.
Event Values Dates in string-event, integer-event, decimal-event and geolocation-event cannot be older than 1990-01-01.
Parameter auto-create The auto-create parameter can not be used with Unique-id and Geolocation fields.
Eventual Consistency The inserted values will be ready to be queried up to 5 seconds after insertion.

Insertion Examples

Inserting Strings

You can insert these values on String columns through a POST request on the /insertion endpoint authenticated with a Database Key.

If the string column which you want to insert data was created and configured as latest-value, you'll be able to insert only one value in this column per entity. Else, if it was configured as list-of-values, you'll be able to insert many values for this column.

Single Value

You can insert only one value for a String latest-value column through a a request like the following:

Entity-id State City
Entity1 CA San Francisco
Entity2 NY New York
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "state": "CA",
            "city": "San Francisco"
        },
        "Entity2": {
            "dimension": "default",
            "state": "NY",
            "city": "New York"
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default ([entity-id], state, city)
VALUES
  ("Entity1", "CA", "San Francisco");
INSERT INTO
  default ([entity-id], state, city)
VALUES
  ("Entity2", "NY", "New York");'
from pyslicer import SlicingDice
import asyncio
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
        "dimension": "default",
        "city": "San Francisco",
        "state": "CA"
    },
    "Entity2": {
    	"dimension": "default",
        "city": "New York",
        "state": "NY"
    },
    "auto-create": [
        "dimension",
        "column"
    ]
}

print(loop.run_until_complete(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("dimension", "default")
            .put("city", "San Francisco")
            .put("state", "CA"))
        .put("Entity2", new JSONObject()
            .put("dimension", "default")
            .put("city", "New York")
            .put("state", "NY"))
        .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" => {
        "dimension" => "default",
        "city" => "San Francisco",
        "state" => "CA"
    },
    "Entity2" => {
        "dimension" => "default",
        "city" => "New York",
        "state" => "NY"
    },
    "auto-create" => [
        "dimension",
        "column"
    ]
}

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

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

const insertData = {
    "Entity1": {
        "dimension": "default",
        "city": "San Francisco",
        "state": "CA"
    },
    "Entity2": {
        "dimension": "default",
        "city": "New York",
        "state": "NY"
    },
    "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(
        "dimension" => "default",
        "city" => "San Francisco",
        "state" => "CA"
    ),
    "Entity2" => array(
        "dimension" => "default",
        "city" => "New York",
        "state" => "NY"
    ),
    "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>{
                    {"dimension", "default"},
                    {"city", "San Francisco"},
                    {"state", "CA"}
                }},
                {"Entity2", new Dictionary<string, dynamic>{
                    {"dimension", "default"},
                    {"city", "New York"},
                    {"state", "NY"}
                }},
                {"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{}{
            "dimension": "default",
            "city": "San Francisco",
            "state": "CA",
        },
        "Entity2": map[string]interface{}{
            "dimension": "default",
            "city": "New York",
            "state": "NY",
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

You can insert multiple values for a String list-of-values column through a a request like the following:

Entity-id Page-content
Entity1 welcome
slicingdice
data
warehouse
analytics
database
service
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "page-content": [
                "welcome",
                "slicingdice",
                "data",
                "warehouse",
                "analytics",
                "database",
                "service"
            ]
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [page-content])
                VALUES ("Entity1", '\''["welcome","slicingdice","data","warehouse","analytics","database","service"]'\'');'
from pyslicer import SlicingDice
import asyncio
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
    	"dimension": "default",
        "page-content": [
            "welcome",
            "slicingdice",
            "data",
            "warehouse",
            "analytics",
            "database",
            "service"
        ]
    },
    "auto-create": [
        "dimension",
        "column"
    ]
}

print(loop.run_until_complete(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("dimension", "default")
            .put("page-content", new JSONArray()
                .put("welcome")
                .put("slicingdice")
                .put("data")
                .put("warehouse")
                .put("analytics")
                .put("database")
                .put("service")))
        .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" => {
        "dimension" => "default",
        "page-content" => [
            "welcome",
            "slicingdice",
            "data",
            "warehouse",
            "analytics",
            "database",
            "service"
        ]
    },
    "auto-create" => [
        "dimension",
        "column"
    ]
}

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

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

const insertData = {
    "Entity1": {
        "dimension": "default",
        "page-content": [
            "welcome",
            "slicingdice",
            "data",
            "warehouse",
            "analytics",
            "database",
            "service"
        ]
    },
    "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(
        "dimension" => "default",
        "page-content" => array(
            "welcome",
            "slicingdice",
            "data",
            "warehouse",
            "analytics",
            "database",
            "service"
        )
    ),
    "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>{
                    {"dimension", "default"},
                    {"page-content", new List<dynamic>{
                        "welcome",
                        "slicingdice",
                        "data",
                        "warehouse",
                        "analytics",
                        "database",
                        "service"
                    }}
                }},
                {"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{}{
            "dimension": "default",
            "page-content": []interface{}{
                "welcome",
                "slicingdice",
                "data",
                "warehouse",
                "analytics",
                "database",
                "service",
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Inserting Integers

You can insert these values on Integer columns through a POST request on the /insertion endpoint authenticated with a Database Key.

You can insert only one value for a Integer latest-value column or an array of values for a Integer list-of-values column.

Entity-id Age
Entity1 32
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "age": 32
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default ([entity-id], age)
VALUES
  ("Entity1", 32);'
from pyslicer import SlicingDice
import asyncio
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
    	"dimension": "default",
        "age": 32
    },
    "auto-create": [
        "dimension",
        "column"
    ]
}

print(loop.run_until_complete(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("dimension", "default")
            .put("age", 32))
        .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" => {
        "dimension" => "default",
        "age" => 32
    },
    "auto-create" => [
        "dimension",
        "column"
    ]
}

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

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

const insertData = {
    "Entity1": {
        "dimension": "default",
        "age": 32
    },
    "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(
        "dimension" => "default",
        "age" => 32
    ),
    "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>{
                    {"dimension", "default"},
                    {"age", 32}
                }},
                {"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{}{
            "dimension": "default",
            "age": 32,
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Inserting Decimals

You can insert these values on Decimal columns through a POST request on the /insertion endpoint authenticated with a Database Key.

You can insert only one value for a Decimal latest-value column or an array of values for a Decimal list-of-values column.

Entity-id Weight
Entity1 98.923
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "weight": 98.923
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default ([entity-id], weight)
VALUES
  ("Entity1", 98.923);'
from pyslicer import SlicingDice
import asyncio
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
        "dimension": "default",
        "weight": 98.923
    },
    "auto-create": [
        "dimension",
        "column"
    ]
}

print(loop.run_until_complete(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("dimension", "default")
            .put("weight", 98.923))
        .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" => {
        "dimension" => "default",
        "weight" => 98.923
    },
    "auto-create" => [
        "dimension",
        "column"
    ]
}

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

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

const insertData = {
    "Entity1": {
        "dimension": "default",
        "weight": 98.923
    },
    "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(
        "dimension" => "default",
        "weight" => 98.923
    ),
    "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>{
                    {"dimension", "default"},
                    {"weight", 98.923}
                }},
                {"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{}{
            "dimension": "default",
            "weight": 98.923,
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Inserting Booleans

You can insert these values on Boolean columns through a POST request on the /insertion endpoint authenticated with a Database Key defining True or False values.

You can insert only one value for a Boolean column.

Entity-id Account-active
Entity1 True
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "account-active": true
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default ([entity-id], [account-active])
VALUES
  ("Entity1", true);'
from pyslicer import SlicingDice
import asyncio
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
    	"dimension": "default",
        "account-active": True
    },
    "auto-create": [
        "dimension",
        "column"
    ]
}

print(loop.run_until_complete(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("dimension", "default")
            .put("account-active", true))
        .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" => {
        "dimension" => "default",
        "account-active" => true
    },
    "auto-create" => [
        "dimension",
        "column"
    ]
}

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

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

const insertData = {
    "Entity1": {
        "dimension": "default",
        "account-active": true
    },
    "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(
        "dimension" => "default",
        "account-active" => true
    ),
    "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>{
                    {"dimension", "default"},
                    {"account-active", true}
                }},
                {"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{}{
            "dimension": "default",
            "account-active": true,
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Inserting Dates

You can insert these values on Date columns through a POST request on the /insertion endpoint authenticated with a Database Key using the ISO8601 format YYYY-MM-DD.

You can insert only one value for a Date latest-value column or an array of values for a Date list-of-values column.

Entity-id Signup-Date
Entity1 2017-04-15
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "signup-date": "2017-04-15"
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default ([entity-id], [signuo-date])
VALUES
  ("Entity1", "2017-04-15");'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
    		"dimension": "default",
        "signup-date": "2017-04-15"
    },
    "auto-create": [
        "dimension",
        "column"
    ]
}

print(loop.run_until_complete(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("dimension", "default")
            .put("signup-date", "2017-04-15"))
        .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" => {
        "dimension" => "default",
        "signup-date" => "2017-04-15"
    },
    "auto-create" => [
        "dimension",
        "column"
    ]
}

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

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

const insertData = {
    "Entity1": {
        "dimension": "default",
        "signup-date": "2017-04-15"
    },
    "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(
        "dimension" => "default",
        "signup-date" => "2017-04-15"
    ),
    "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>{
                    {"dimension", "default"},
                    {"signup-date", "2017-04-15"}
                }},
                {"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{}{
            "dimension": "default",
            "signup-date": "2017-04-15",
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Inserting Datetime

You can insert these values on Datetime columns through a POST request on the /insertion endpoint authenticated with a Database Key using the ISO8601 format YYYY-MM-DDTHH:MM:SSZ.

You can insert only one value for a Datetime latest-value column or an array of values for a Datetime list-of-values column.

Entity-id Signup-Time
Entity1 2018-05-30T15:22:50Z
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "signup-time": "2018-05-30T15:22:50Z"
        }
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default ([entity-id], [signup-time])
VALUES
  ("Entity1", "2018-05-30T15:22:50Z");'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
        "signup-time": "2018-05-30T15:22:50Z"
    }
}

print(loop.run_until_complete(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("signup-time", "2018-05-30T15:22:50Z"));

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

insert_data = {
    "Entity1" => {
        "signup-time" => "2018-05-30T15:22:50Z"
    }
}

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

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

const insertData = {
    "Entity1": {
        "signup-time": "2018-05-30T15:22:50Z"
    }
};

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(
        "signup-time" => "2018-05-30T15:22:50Z"
    )
);

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>{
                    {"signup-time", "2018-05-30T15:22:50Z"}
                }}
            };

            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{}{
            "signup-time": "2018-05-30T15:22:50Z",
        },
    }

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

Inserting Unique-id

You can insert these values on Unique-Id columns through a POST request on the /insertion endpoint authenticated with a Database Key.

You can insert only one value for a Unique-Id column.

Entity-id Email
Entity1 user1@slicingdice.com
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "email": "user1@slicingdice.com"
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default ([entity-id], email)
VALUES
  ("Entity1", "user1@slicingdice.com");'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
    	"dimension": "default",
        "email": "user1@slicingdice.com"
    }
}

print(loop.run_until_complete(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("dimension", "default")
            .put("email", "user1@slicingdice.com"));

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

insert_data = {
    "Entity1" => {
        "dimension" => "default",
        "email" => "user1@slicingdice.com"
    }
}

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

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

const insertData = {
    "Entity1": {
        "dimension": "default",
        "email": "user1@slicingdice.com"
    }
};

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(
        "dimension" => "default",
        "email" => "user1@slicingdice.com"
    )
);

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>{
                    {"dimension", "default"},
                    {"email", "user1@slicingdice.com"}
                }}
            };

            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{}{
            "dimension": "default",
            "email": "user1@slicingdice.com",
        }
    }

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


Inserting Geolocations

You can insert these values on Geolocation columns through a POST request on the /insertion endpoint authenticated with a Database Key following the [longitude,latitude] format.

You can insert only one value for a Unique-Id column.

Entity-id Location
Entity1 [-23.625807,-46.702000]
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "location": [-23.625807,-46.702000]
        }
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
        "location": [-23.625807,-46.702000]
    }
}

print(loop.run_until_complete(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("location", [-23.625807,-46.702000]));

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

insert_data = {
    "Entity1" => {
        "location" => [-23.625807,-46.702000]
    }
}

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

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

const insertData = {
    "Entity1": {
        "location": [-23.625807,-46.702000]
    }
};

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(
        "location" => [-23.625807,-46.702000]
    )
);

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>{
                    {"location", [-23.625807,-46.702000]}
                }}
            };

            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{}{
            "location": [-23.625807,-46.702000],
        },
    }

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



Inserting String Events

You can insert these values on String Event columns through a POST request on the /insertion endpoint authenticated with a Database Key following the ISO8601 YYYY-MM-DDThh:mm:ssTZ date format for the events. If you omit the date parameter SlicingDice will select the current timestamp to be used.

Entity-id Page-View
Entity1 /online-demo - 2019-04-15T10:35:23Z
/about - 2019-04-15T10:42:17Z
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "page-view": [
                {
                    "value": "/online-demo",
                    "date": "2019-04-15T10:35:23Z"
                }, {
                    "value": "/about",
                    "date": "2019-04-15T10:42:17Z"
                }
            ]
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default (
    [entity-id],
    [page-view.0.value],
    [page-view.0.date],
    [page-view.1.value],
    [page-view.1.date]
  )
VALUES
  (
    "Entity1",
    "/online-demo",
    "2019-04-15T10:35:23Z",
    "/about",
    "2019-04-15T10:42:17Z"
  );'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
    	"dimension": "default",
        "page-view": [
            {
                "date": "2019-04-15T10:35:23Z",
                "value": "/online-demo"
            },
            {
                "date": "2019-04-15T10:42:17Z",
                "value": "/about"
            }
        ]
    },
    "auto-create": [
        "dimension",
        "column"
    ]
}

print(loop.run_until_complete(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("dimension", "default")
            .put("page-view", new JSONArray()
                .put(new JSONObject()
                    .put("date", "2019-04-15T10:35:23Z")
                    .put("value", "/online-demo"))
                .put(new JSONObject()
                    .put("date", "2019-04-15T10:42:17Z")
                    .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" => {
        "dimension" => "default",
        "page-view" => [
            {
                "date" => "2019-04-15T10:35:23Z",
                "value" => "/online-demo"
            },
            {
                "date" => "2019-04-15T10:42:17Z",
                "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": {
        "dimension": "default",
        "page-view": [
            {
                "date": "2019-04-15T10:35:23Z",
                "value": "/online-demo"
            },
            {
                "date": "2019-04-15T10:42:17Z",
                "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(
        "dimension" => "default",
        "page-view" => array(
            array(
                "date" => "2019-04-15T10:35:23Z",
                "value" => "/online-demo"
            ),
            array(
                "date" => "2019-04-15T10:42:17Z",
                "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>{
                    {"dimension", "default"},
                    {"page-view", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "2019-04-15T10:35:23Z"},
                            {"value", "/online-demo"}
                        },
                        new Dictionary<string, dynamic>{
                            {"date", "2019-04-15T10:42:17Z"},
                            {"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{}{
            "dimension": "default",
            "page-view": []interface{}{
                map[string]interface{}{
                    "date": "2019-04-15T10:35:23Z",
                    "value": "/online-demo",
                },
                map[string]interface{}{
                    "date": "2019-04-15T10:42:17Z",
                    "value": "/about",
                },
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Inserting Integer Events

You can insert these values on Integer Event columns through a POST request on the /insertion endpoint authenticated with a Database Key following the ISO8601 YYYY-MM-DDThh:mm:ssTZ date format for the events. If you omit the date parameter SlicingDice will select the current timestamp to be used.

Entity-id Purchase-Amount
Entity1 129 - 2019-04-15T09:25:19Z
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "purchase-amount": {
                "value": 129,
                "date": "2019-04-15T09:25:19Z"
            }
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default (
    [entity-id],
    [purchase-amount.0.value],
    [purchase-amount.0.date]
  )
VALUES
  ("Entity1", 129, "2019-04-15T09:25:19Z");'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
    	"dimension": "default",
        "purchase-amount": {
            "date": "2019-04-15T09:25:19Z",
            "value": 129
        }
    },
    "auto-create": [
        "dimension",
        "column"
    ]
}

print(loop.run_until_complete(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("dimension", "default")
            .put("purchase-amount", new JSONObject()
                .put("date", "2019-04-15T09:25:19Z")
                .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" => {
        "dimension" => "default",
        "purchase-amount" => {
            "date" => "2019-04-15T09:25:19Z",
            "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": {
        "dimension": "default",
        "purchase-amount": {
            "date": "2019-04-15T09:25:19Z",
            "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(
        "dimension" => "default",
        "purchase-amount" => array(
            "date" => "2019-04-15T09:25:19Z",
            "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>{
                    {"dimension", "default"},
                    {"purchase-amount", new Dictionary<string, dynamic>{
                        {"date", "2019-04-15T09:25:19Z"},
                        {"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{}{
            "dimension": "default",
            "purchase-amount": map[string]interface{}{
                "date": "2019-04-15T09:25:19Z",
                "value": 129,
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Inserting Decimal Events

You can insert these values on Decimal Event columns through a POST request on the /insertion endpoint authenticated with a Database Key following the ISO8601 YYYY-MM-DDThh:mm:ssTZ date format for the events. If you omit the date parameter SlicingDice will select the current timestamp to be used.

Entity-id Temperature
Entity1 27.943 - 2019-04-15T09:25:19Z
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "dimension": "default",
            "temperature": {
                "value": 27.943,
                "date": "2019-04-15T09:25:19Z"
            }
        },
        "auto-create": ["dimension", "column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO
  default (
    [entity-id],
    [temperature.0.value],
    [temperature.0.date]
  )
VALUES
  ("Entity1", 27.943, "2019-04-15T09:25:19Z");'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
    	"dimension": "default",
        "temperature": {
            "date": "2019-04-15T09:25:19Z",
            "value": 27.943
        }
    },
    "auto-create": [
        "dimension",
        "column"
    ]
}

print(loop.run_until_complete(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("dimension", "default")
            .put("temperature", new JSONObject()
                .put("date", "2019-04-15T09:25:19Z")
                .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" => {
        "dimension" => "default",
        "temperature" => {
            "date" => "2019-04-15T09:25:19Z",
            "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": {
        "dimension": "default",
        "temperature": {
            "date": "2019-04-15T09:25:19Z",
            "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(
        "dimension" => "default",
        "temperature" => array(
            "date" => "2019-04-15T09:25:19Z",
            "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>{
                    {"dimension", "default"},
                    {"temperature", new Dictionary<string, dynamic>{
                        {"date", "2019-04-15T09:25:19Z"},
                        {"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{}{
            "dimension": "default",
            "temperature": map[string]interface{}{
                "date": "2019-04-15T09:25:19Z",
                "value": 27.943,
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

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

Inserting Geolocation Events

You can insert these values on Geolocation Event columns through a POST request on the /insertion endpoint authenticated with a Database Key following the ISO8601 YYYY-MM-DDThh:mm:ssTZ date format for the events. If you omit the date parameter SlicingDice will select the current timestamp to be used.

Entity-id Location
Entity1 [-23.625807,-46.702000] - 2019-01-14T21:55:01Z
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
         "Entity1":{
            "location":[
               {
                  "date":"2019-01-14T21:55:01Z",
                  "value":[
                     -23.625807,
                     -46.702000
                  ]
               }
            ]
         }
      }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

insert_data = {
    "Entity1": {
        "location": {
            "date": "2019-02-04T10:35:23Z",
            "value": [-23.625807,-46.702000]
        }
    }
}

print(loop.run_until_complete(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("location", new JSONObject()
                .put("date", "2019-01-04T21:55:01Z")
                .put("value", [-23.625807,-46.702000])));

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

insert_data = {
    "Entity1" => {
        "location" => {
            "date" => "2019-01-14T21:55:01Z",
            "value" => [-23.625807,-46.702000]
        }
    }
}

puts slicingdice.insert(insert_data)
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

insert_data = {
    "Entity1" => {
        "location" => {
            "date" => "2019-01-14T21:55:01Z",
            "value" => [-23.625807,-46.702000]
        }
    }
}

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

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

const insertData = {
    "Entity1": {
        "location": {
            "date": "2019-01-14T21:55:01Z",
            "value": [-23.625807,-46.702000]
        }
    }
};

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(
        "location" => array(
            "date" => "2019-01-14T21:55:01Z",
            "value" => [-23.625807,-46.702000]
        )
    )
);

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>{
                    {"location", new Dictionary<string, dynamic>{
                        {"date", "2019-01-14T21:55:01Z"},
                        {"value", [-23.625807,-46.702000]}
                    }}
                }}
            };

            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{}{
            "location": map[string]interface{}{
                "date": "2019-01-14T21:55:01Z",
                "value": [-23.625807,-46.702000],
            },
        },
    }

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


Updating data

You can update any data you have stored on your columns through a POST request on the /update endpoint authenticated with a Database Key. First, you should define a query parameter to select the records that will be updated and then you define a set parameter containing the update that will be executed.

Notice that you can only update records from columns that are not related with events and uses the latest-value storage configuration.

curl -X POST https://api.slicingdice.com/v1/update \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
   "dimension":"users",
   "query":[
      {
         "entity-id":{
            "equals":"UUID-01"
         }
      }
   ],
   "set":{
      "name":"Mary"
   }
}'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'UPDATE users SET name = 'Mary' WHERE [entity-id] = 'UUID-01';'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

update_data = {
    "query": [
        {
            "entity-id": {
                "equals": "UUID-01"
            }
        }
    ],
    "set": {
        "name": "Mary"
    },
    "dimension": "users"
}

print(loop.run_until_complete(slicingdice.update(update_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 updateData = new JSONObject()
        .put("query", new JSONArray()
            .put(new JSONObject()
                .put("entity-id", new JSONObject()
                    .put("equals", "UUID-01"))))
        .put("set", new JSONObject()
            .put("name", "Mary"))
        .put("dimension", "users");

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

update_data = {
    "query" => [
        {
            "entity-id" => {
                "equals" => "UUID-01"
            }
        }
    ],
    "set" => {
        "name" => "Mary"
    },
    "dimension" => "users"
}

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

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

const updateData = {
    "query": [
        {
            "entity-id": {
                "equals": "UUID-01"
            }
        }
    ],
    "set": {
        "name": "Mary"
    },
    "dimension": "users"
};

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

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

$updateData = array(
    "query" => array(
        array(
            "entity-id" => array(
                "equals" => "UUID-01"
            )
        )
    ),
    "set" => array(
        "name" => "Mary"
    ),
    "dimension" => "users"
);

print_r($slicingdice->update($updateData));
?>
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 updateData = new Dictionary<string, dynamic>{
                {"query", new List<dynamic>{
                    new Dictionary<string, dynamic>{
                        {"entity-id", new Dictionary<string, dynamic>{
                            {"equals", "UUID-01"}
                        }}
                    }
                }},
                {"set", new Dictionary<string, dynamic>{
                    {"name", "Mary"}
                }},
                {"dimension", "users"}
            };

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

    updateData := map[string]interface{}{
        "query": []interface{}{
            map[string]interface{}{
                "entity-id": map[string]interface{}{
                    "equals": "UUID-01",
                },
            },
        },
        "set": map[string]interface{}{
            "name": "Mary",
        },
        "dimension": "users",
    }

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


Deleting data

You can delete any data you have stored on your columns through a POST request on the /delete endpoint authenticated with a Database Key. You should define a query parameter to select the records that will be deleted.

curl -X POST https://api.slicingdice.com/v1/delete \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
   "dimension":"users",
   "query":[
      {
         "entity-id":{
            "equals":"UUID-01"
         }
      }
   ]
}'
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'DELETE FROM users WHERE [entity-id] = 'UUID-01';'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')
loop = asyncio.get_event_loop()

delete_data = {
    "query": [
        {
            "entity-id": {
                "equals": "UUID-01"
            }
        }
    ],
    "dimension": "users"
}

print(loop.run_until_complete(slicingdice.delete(delete_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 deleteData = new JSONObject()
        .put("query", new JSONArray()
            .put(new JSONObject()
                .put("entity-id", new JSONObject()
                    .put("equals", "UUID-01"))))
        .put("dimension", "users");

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

delete_data = {
    "query" => [
        {
            "entity-id" => {
                "equals" => "UUID-01"
            }
        }
    ],
    "dimension" => "users"
}

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

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

const deleteData = {
    "query": [
        {
            "entity-id": {
                "equals": "UUID-01"
            }
        }
    ],
    "dimension": "users"
};

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

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

$deleteData = array(
    "query" => array(
        array(
            "entity-id" => array(
                "equals" => "UUID-01"
            )
        )
    ),
    "dimension" => "users"
);

print_r($slicingdice->delete($deleteData));
?>
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 deleteData = new Dictionary<string, dynamic>{
                {"query", new List<dynamic>{
                    new Dictionary<string, dynamic>{
                        {"entity-id", new Dictionary<string, dynamic>{
                            {"equals", "UUID-01"}
                        }}
                    }
                }},
                {"dimension", "users"}
            };

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

    deleteData := map[string]interface{}{
        "query": []interface{}{
            map[string]interface{}{
                "entity-id": map[string]interface{}{
                    "equals": "UUID-01",
                },
            },
        },
        "dimension": "users",
    }

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