SlicingDice Documentation

SlicingDice API Docs

Welcome to the SlicingDice API documentation. You'll find comprehensive guides and documentation to help you start working with SlicingDice as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Guides

How to make a single insert

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

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

On this page, we show how to perform a single insertion on your SlicingDice database using all the methods available.

The table below shows the data that will be inserted in the examples. In the examples, we will use the default dimension but you can choose any dimension you want.

Entities
State
City

Entity1

CA

San Francisco

JDBC and ODBC SQL Drivers

Inserting the data from the table above with the standard SQL, using the SlicingDice's JDBC and ODBC SQL Drivers.

INSERT INTO default ([entity-id], state, city) 
VALUES ("Entity1", "CA", "San Francisco");

API-based SQL endpoint

Inserting the data from the table above with the SQL language, using the SlicingDice's API-based SQL endpoint.

$ 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");'

API-based JSON endpoint

Inserting the data from the table above with the JSON, using the SlicingDice's API-based JSON endpoint.

$ 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"
        }
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
    		"dimension": "default",
        "city": "San Francisco",
        "state": "CA"
    }
}

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("dimension", "default")
            .put("city", "San Francisco")
            .put("state", "CA"))

        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"
    },
}

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"
    }
};

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"
    )
);

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"}
                }}
            };

            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",
        },
    }

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