SlicingDice Documentation

SlicingDice - The All-in-One Solution Documentation

Welcome to the SlicingDice 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
Suggest Edits

POST /insert

Endpoint purpose: inserting data to an existing database.

 
posthttps://api.slicingdice.com/v1/insert
curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "UUID-01": {
            "name": "Jeff",
            "age": 25,
            "clicks": [
                {
                    "value": "Add to Cart",
                    "date": "2017-05-26T12:54:12Z"
                }, {
                    "value": "Pay Now",
                    "date": "2017-05-31T10:22:10Z"
                }, {
                    "value": "Support",
                    "date": "2017-06-03T17:05:25Z"
                }
            ],
            "dimension": "users"
        },
        "auto-create": ["dimension", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "2017-05-26T12:54:12Z",
                "value": "Add to Cart"
            }, 
            {
                "date": "2017-05-31T10:22:10Z",
                "value": "Pay Now"
            }, 
            {
                "date": "2017-06-03T17:05:25Z",
                "value": "Support"
            }
        ]
    },
    "auto-create": [
        "dimension", 
        "column"
    ]
}

print(slicingdice.insert(insert_data))
import com.slicingdice.jslicer.SlicingDice;
import java.io.IOException;
import org.json.JSONObject;
import org.json.JSONArray;

public class Example {
    public static void main(String[] args) throws IOException {
        SlicingDice slicingdice = new SlicingDice("MASTER_API_KEY");

        JSONObject insertData = new JSONObject()
        .put("UUID-01", new JSONObject()
            .put("dimension", "users")
            .put("age", 25)
            .put("name", "Jeff")
            .put("clicks", new JSONArray()
                .put(new JSONObject()
                    .put("date", "2017-05-26T12:54:12Z")
                    .put("value", "Add to Cart"))
                .put(new JSONObject()
                    .put("date", "2017-05-31T10:22:10Z")
                    .put("value", "Pay Now"))
                .put(new JSONObject()
                    .put("date", "2017-06-03T17:05:25Z")
                    .put("value", "Support"))))
        .put("auto-create", new JSONArray()
            .put("dimension")
            .put("column"));

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

insert_data = {
    "UUID-01" => {
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => [
            {
                "date" => "2017-05-26T12:54:12Z",
                "value" => "Add to Cart"
            }, 
            {
                "date" => "2017-05-31T10:22:10Z",
                "value" => "Pay Now"
            }, 
            {
                "date" => "2017-06-03T17:05:25Z",
                "value" => "Support"
            }
        ]
    },
    "auto-create" => [
        "dimension", 
        "column"
    ]
}

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

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

const insertData = {
    "UUID-01": {
        "dimension": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "2017-05-26T12:54:12Z",
                "value": "Add to Cart"
            }, 
            {
                "date": "2017-05-31T10:22:10Z",
                "value": "Pay Now"
            }, 
            {
                "date": "2017-06-03T17:05:25Z",
                "value": "Support"
            }
        ]
    },
    "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(
    "UUID-01" => array(
        "dimension" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => array(
            array(
                "date" => "2017-05-26T12:54:12Z",
                "value" => "Add to Cart"
            ), 
            array(
                "date" => "2017-05-31T10:22:10Z",
                "value" => "Pay Now"
            ), 
            array(
                "date" => "2017-06-03T17:05:25Z",
                "value" => "Support"
            )
        )
    ),
    "auto-create" => array(
        "dimension", 
        "column"
    )
);

print_r($slicingdice->insert($insertData));
?>
using System.Collections.Generic;
using Slicer;
using Newtonsoft.Json;

namespace SlicerTester.Console
{
    class Program
    {
        static void Main(string[] args)
        {
            var slicingdice = new SlicingDice(masterKey: "MASTER_API_KEY");

            var insertData = new Dictionary<string, dynamic>{
                {"UUID-01", new Dictionary<string, dynamic>{
                    {"dimension", "users"},
                    {"age", 25},
                    {"name", "Jeff"},
                    {"clicks", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "2017-05-26T12:54:12Z"},
                            {"value", "Add to Cart"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "2017-05-31T10:22:10Z"},
                            {"value", "Pay Now"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "2017-06-03T17:05:25Z"},
                            {"value", "Support"}
                        }
                    }}
                }},
                {"auto-create", new List<dynamic>{
                    "dimension", 
                    "column"
                }}
            };

            var result = slicingdice.Insert(insertData);
            System.Console.WriteLine(JsonConvert.SerializeObject(result).ToString());
        }
    }
}
package main
import (
    "fmt"
    "github.com/SlicingDice/slicingdice-go/slicingdice"
)
func main() {
    keys := new(slicingdice.APIKey)
    keys.MasterKey = "MASTER_API_KEY"
    slicingdice := slicingdice.New(keys, 60)

    insertData := map[string]interface{}{
        "UUID-01": map[string]interface{}{
            "dimension": "users",
            "age": 25,
            "name": "Jeff",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "2017-05-26T12:54:12Z",
                    "value": "Add to Cart",
                },
                map[string]interface{}{
                    "date": "2017-05-31T10:22:10Z",
                    "value": "Pay Now",
                },
                map[string]interface{}{
                    "date": "2017-06-03T17:05:25Z",
                    "value": "Support",
                },
            },
        },
        "auto-create": []interface{}{
            "dimension",
            "column",
        },
    }

    fmt.Println(slicingdice.Insert(insertData))
}
A binary file was returned

You couldn't be authenticated

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

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object, like the example above, where the keys are entity IDs and values are other JSON objects containing data for that entity.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid Database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /insert endpoint accepts HTTPS and also HTTP requests for cases where secure connection is not possible, like insertion requests coming from the Arduino client library.

Limits and Restrictions

Below is the list of limits and restrictions for the /insert endpoint:

Operation
Limits

Request rate limit

  • At most 1,000 entity IDs or 5,000 columns per request, whichever is reached first. This means you can insert by default at most 5 million entities or 25 million columns per minute. Larger limits can be arranged by simply getting in contact with us.

String values limit

Values for unique-id, string and string-event columns can have at most 1,000 characters.

Numeric values limit

Values for integer, integer-event and enumerated columns must be in the interval from -9,223,372,036,854,775,808(-263) to 9,223,372,036,854,775,807 (263 - 1).

Decimal values limit

Values for decimal and decimal-event columns must be in the interval from (-263/10p) to ((263 - 1)/10p) given p decimal places.

Date column format

Values for date column must be in YYYY-MM-DD format.

Datetime column format

Values for datetime column must be in YYYY-MM-DDTHH:MM:SSZ format.

Event dates limit

Dates in string-event, integer-event and decimal-event cannot be older than 12 years ago. So the earliest date allowed for today is: 2005-01-01.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /insert endpoint accepts: Master Key, Write Key or a Custom Database Key configured as write-read or write-only key.

You can also use the demo Database Key to insert data on a test database.

Errors

Access this page for the full list of all possible errors related to the /insert endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /insert endpoint.

Check also the data insertion demo tool we created, so you can easily understand how to insert your data on SlicingDice, or use this tool if you simply want to validate if an existing JSON insertion command is valid/correct.

Suggest Edits

POST /update

 
posthttps://api.slicingdice.com/v1/update
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"
   }
}'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

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

print(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))
}
A binary file was returned

You couldn't be authenticated

{
	"status": "success",
	"result": {
		"updated": 1
	},
	"took": 0.033214569091796875
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object, like the example above, where we specify the query to select the entities to be updated and the set parameter.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid Database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /update endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /update endpoint:

Operation
Limits

Request rate limit

  • At most 600 requests per minute (10 requests per second).

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /update endpoint accepts: Master Key, Write Key or a Custom Database Key configured as write-read or write-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /update endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the update endpoint.

Suggest Edits

POST /delete

 
posthttps://api.slicingdice.com/v1/delete
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"
         }
      }
   ]
}'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

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

print(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))
}
A binary file was returned

You couldn't be authenticated

{
	"status": "success",
	"result": {
		"deleted": 1
	},
	"took": 0.014542579650878906
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object, like the example above, where we specify the query to select the entities to be deleted.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid Database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /delete endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /delete endpoint:

Operation
Limits

Request rate limit

  • At most 600 requests per minute (10 requests per second).

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /delete endpoint accepts: Master Key, Write Key or a Custom Database Key configured as write-read or write-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /delete endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /delete endpoint.

Suggest Edits

POST /query/count/entity

Endpoint purpose: retrieve the number of entities that satisfy the query for the given database, according to the Database key.

 
posthttps://api.slicingdice.com/v1/query/count/entity
curl -X POST https://api.slicingdice.com/v1/query/count/entity \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '[
        {
            "query-name": "jeff-user-clicked-to-pay",
            "dimension": "users",
            "query": [
                {
                    "name": {
                        "equals": "Jeff"
                    }
                },
                "and",
                {
                    "clicks": {
                        "equals": "Pay Now",
                        "between": [
                            "2017-05-21T00:00:00Z",
                            "2017-06-04T00:00:00Z"
                        ]
                    }
                }
            ],
            "bypass-cache": true
        }
    ]'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

query_data = [
    {
        "dimension": "users",
        "query-name": "jeff-user-clicked-to-pay",
        "bypass-cache": True,
        "query": [
            {
                "name": {
                    "equals": "Jeff"
                }
            }, 
            "and", 
            {
                "clicks": {
                    "equals": "Pay Now",
                    "between": [
                        "2017-05-21T00:00:00Z", 
                        "2017-06-04T00:00:00Z"
                    ]
                }
            }
        ]
    }
]

print(slicingdice.count_entity(query_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");

        JSONArray queryData = new JSONArray()
        .put(new JSONObject()
            .put("dimension", "users")
            .put("query-name", "jeff-user-clicked-to-pay")
            .put("bypass-cache", true)
            .put("query", new JSONArray()
                .put(new JSONObject()
                    .put("name", new JSONObject()
                        .put("equals", "Jeff")))
                .put("and")
                .put(new JSONObject()
                    .put("clicks", new JSONObject()
                        .put("equals", "Pay Now")
                        .put("between", new JSONArray()
                            .put("2017-05-21T00:00:00Z")
                            .put("2017-06-04T00:00:00Z"))))));
        JSONObject result = slicingdice.countEntity(queryData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

query_data = [
    {
        "dimension" => "users",
        "query-name" => "jeff-user-clicked-to-pay",
        "bypass-cache" => true,
        "query" => [
            {
                "name" => {
                    "equals" => "Jeff"
                }
            }, 
            "and", 
            {
                "clicks" => {
                    "equals" => "Pay Now",
                    "between" => [
                        "2017-05-21T00:00:00Z", 
                        "2017-06-04T00:00:00Z"
                    ]
                }
            }
        ]
    }
]

puts slicingdice.count_entity(query_data)
const SlicingDice = require('slicerjs');

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

const queryData = [
    {
        "dimension": "users",
        "query-name": "jeff-user-clicked-to-pay",
        "bypass-cache": true,
        "query": [
            {
                "name": {
                    "equals": "Jeff"
                }
            }, 
            "and", 
            {
                "clicks": {
                    "equals": "Pay Now",
                    "between": [
                        "2017-05-21T00:00:00Z", 
                        "2017-06-04T00:00:00Z"
                    ]
                }
            }
        ]
    }
];

slicingdice.countEntity(queryData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$queryData = array(
    array(
        "dimension" => "users",
        "query-name" => "jeff-user-clicked-to-pay",
        "bypass-cache" => true,
        "query" => array(
            array(
                "name" => array(
                    "equals" => "Jeff"
                )
            ), 
            "and", 
            array(
                "clicks" => array(
                    "equals" => "Pay Now",
                    "between" => array(
                        "2017-05-21T00:00:00Z", 
                        "2017-06-04T00:00:00Z"
                    )
                )
            )
        )
    )
);

print_r($slicingdice->countEntity($queryData));
?>
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 queryData = new List<dynamic>{
                new Dictionary<string, dynamic>{
                    {"dimension", "users"},
                    {"query-name", "jeff-user-clicked-to-pay"},
                    {"bypass-cache", true},
                    {"query", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"name", new Dictionary<string, dynamic>{
                                {"equals", "Jeff"}
                            }}
                        }, 
                        "and", 
                        new Dictionary<string, dynamic>{
                            {"clicks", new Dictionary<string, dynamic>{
                                {"equals", "Pay Now"},
                                {"between", new List<dynamic>{
                                    "2017-05-21T00:00:00Z", 
                                    "2017-06-04T00:00:00Z"
                                }}
                            }}
                        }
                    }}
                }
            };

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

    queryData := []interface{}{
        map[string]interface{}{
            "dimension": "users",
            "query-name": "jeff-user-clicked-to-pay",
            "bypass-cache": true,
            "query": []interface{}{
                map[string]interface{}{
                    "name": map[string]interface{}{
                        "equals": "Jeff",
                    },
                },
                "and",
                map[string]interface{}{
                    "clicks": map[string]interface{}{
                        "equals": "Pay Now",
                        "between": []interface{}{
                            "2017-05-21T00:00:00Z",
                            "2017-06-04T00:00:00Z",
                        },
                    },
                },
            },
        },
    }

    fmt.Println(slicingdice.CountEntity(queryData))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "result": {
        "jeff-user-clicked-to-pay": 1
    },
    "took": 0.103
}

Body Params

Request Body
json
required

The body of the request is expected to have an array of JSON objects (or a single JSON object) of queries identified by unique names (query-name), each containing a list of columns and conditions and operators, if any.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/count/entity endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/count/entity endpoint:

Operation
Limits

Request rate limit

  • At most 1,200 requests per minute (20 requests per second), according to the Query Load plan selected for the database.
  • At most 10 queries per request.
  • At most 20 columns per query.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/count/entity endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/count/entity endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/count/entity endpoint.

Check also the query demo tool we created, so you can easily understand how to query your data on SlicingDice, or use this tool to validate if an existing JSON query command is valid/correct.

Suggest Edits

POST /query/count/event

Endpoint purpose: retrieve the number of entities that satisfy the query for the given database, according to the Database key.

 
posthttps://api.slicingdice.com/v1/query/count/event
curl -X POST https://api.slicingdice.com/v1/query/count/event \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '[
    {
        "query-name": "visited-page-events",
        "query": [
            {
                "actions": {
                    "equals": "visited-page",
                    "between": [
                        "2017-05-21T00:00:00Z",
                        "2017-06-04T00:00:00Z"
                    ]
                }
            }
        ]
    }
]'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

query_data = [
    {
        "query": [
            {
                "actions": {
                    "equals": "visited-page",
                    "between": [
                        "2017-05-21T00:00:00Z", 
                        "2017-06-04T00:00:00Z"
                    ]
                }
            }
        ],
        "query-name": "visited-page-events"
    }
]

print(slicingdice.count_event(query_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");

        JSONArray queryData = new JSONArray()
        .put(new JSONObject()
            .put("query", new JSONArray()
                .put(new JSONObject()
                    .put("actions", new JSONObject()
                        .put("equals", "visited-page")
                        .put("between", new JSONArray()
                            .put("2017-05-21T00:00:00Z")
                            .put("2017-06-04T00:00:00Z")))))
            .put("query-name", "visited-page-events"));
        JSONObject result = slicingdice.countEvent(queryData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

query_data = [
    {
        "query" => [
            {
                "actions" => {
                    "equals" => "visited-page",
                    "between" => [
                        "2017-05-21T00:00:00Z", 
                        "2017-06-04T00:00:00Z"
                    ]
                }
            }
        ],
        "query-name" => "visited-page-events"
    }
]

puts slicingdice.count_event(query_data)
const SlicingDice = require('slicerjs');

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

const queryData = [
    {
        "query": [
            {
                "actions": {
                    "equals": "visited-page",
                    "between": [
                        "2017-05-21T00:00:00Z", 
                        "2017-06-04T00:00:00Z"
                    ]
                }
            }
        ],
        "query-name": "visited-page-events"
    }
];

slicingdice.countEvent(queryData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$usesTestEndpoint = true;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"), $usesTestEndpoint);

$queryData = array(
    array(
        "query" => array(
            array(
                "actions" => array(
                    "equals" => "visited-page",
                    "between" => array(
                        "2017-05-21T00:00:00Z", 
                        "2017-06-04T00:00:00Z"
                    )
                )
            )
        ),
        "query-name" => "visited-page-events"
    )
);

print_r($slicingdice->countEvent($queryData));
?>
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 queryData = new List<dynamic>{
                new Dictionary<string, dynamic>{
                    {"query", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"actions", new Dictionary<string, dynamic>{
                                {"equals", "visited-page"},
                                {"between", new List<dynamic>{
                                    "2017-05-21T00:00:00Z", 
                                    "2017-06-04T00:00:00Z"
                                }}
                            }}
                        }
                    }},
                    {"query-name", "visited-page-events"}
                }
            };

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

    queryData := []interface{}{
        map[string]interface{}{
            "query": []interface{}{
                map[string]interface{}{
                    "actions": map[string]interface{}{
                        "equals": "visited-page",
                        "between": []interface{}{
                            "2017-05-21T00:00:00Z",
                            "2017-06-04T00:00:00Z",
                        },
                    },
                },
            },
            "query-name": "visited-page-events",
        },
    }

    fmt.Println(slicingdice.CountEvent(queryData))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "result": {
        "visited-page-events": 1
    },
    "took": 0.103
}

Body Params

Request Body
json
required

The body of the request is expected to have an array of JSON objects (or a single JSON object) of queries identified by unique names (query-name), each containing a list of columns and conditions and operators, if any.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/count/event endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/count/event endpoint:

Operation
Limits

Request rate limit

  • At most 1,200 requests per minute (20 requests per second), according to the Query Load plan selected for the database.
  • At most 10 queries per request.
  • At most 10 columns per query.

Query Interval Resolution

Interval resolutions for event columns of seconds and minutes can be used only for the past 24 hours, whereas intervals of hours can be used for the past 30 days. Intervals with resolution of days can be always used.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/count/event endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/count/event endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/count/event endpoint.

Check also the query demo tool we created, so you can easily understand how to query your data on SlicingDice, or use this tool to validate if an existing JSON query command is valid/correct.

Suggest Edits

POST /query/aggregation

Endpoint purpose: cross data from different columns and apply aggregation metrics for the given database, according to the Database key.

 
posthttps://api.slicingdice.com/v1/query/aggregation
curl -X POST https://api.slicingdice.com/v1/query/aggregation \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "filter": [
            {
                "country": { "equals": "USA" }
            }
        ],
        "query": [
            {
                "purchased-products": 2,
                "between": [
                    "2017-05-16T00:00:00Z",
                    "2017-06-04T00:00:00Z"
                ]
            }
        ]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

query_data = {
    "filter": [
        {
            "country": {
                "equals": "USA"
            }
        }
    ],
    "query": [
        {
            "purchased-products": 2,
            "between": [
                "2017-05-16T00:00:00Z", 
                "2017-06-04T00:00:00Z"
            ]
        }
    ]
}

print(slicingdice.aggregation(query_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 queryData = new JSONObject()
        .put("filter", new JSONArray()
            .put(new JSONObject()
                .put("country", new JSONObject()
                    .put("equals", "USA"))))
        .put("query", new JSONArray()
            .put(new JSONObject()
                .put("purchased-products", 2)
                .put("between", new JSONArray()
                    .put("2017-05-16T00:00:00Z")
                    .put("2017-06-04T00:00:00Z"))));
        JSONObject result = slicingdice.aggregation(queryData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

query_data = {
    "filter" => [
        {
            "country" => {
                "equals" => "USA"
            }
        }
    ],
    "query" => [
        {
            "purchased-products" => 2,
            "between" => [
                "2017-05-16T00:00:00Z", 
                "2017-06-04T00:00:00Z"
            ]
        }
    ]
}

puts slicingdice.aggregation(query_data)
const SlicingDice = require('slicerjs');

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

const queryData = {
    "filter": [
        {
            "country": {
                "equals": "USA"
            }
        }
    ],
    "query": [
        {
            "purchased-products": 2,
            "between": [
                "2017-05-16T00:00:00Z", 
                "2017-06-04T00:00:00Z"
            ]
        }
    ]
};

slicingdice.aggregation(queryData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$queryData = array(
    "filter" => array(
        array(
            "country" => array(
                "equals" => "USA"
            )
        )
    ),
    "query" => array(
        array(
            "purchased-products" => 2,
            "between" => array(
                "2017-05-16T00:00:00Z", 
                "2017-06-04T00:00:00Z"
            )
        )
    )
);

print_r($slicingdice->aggregation($queryData));
?>
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 queryData = new Dictionary<string, dynamic>{
                {"filter", new List<dynamic>{
                    new Dictionary<string, dynamic>{
                        {"country", new Dictionary<string, dynamic>{
                            {"equals", "USA"}
                        }}
                    }
                }},
                {"query", new List<dynamic>{
                    new Dictionary<string, dynamic>{
                        {"purchased-products", 2},
                        {"between", new List<dynamic>{
                            "2017-05-16T00:00:00Z", 
                            "2017-06-04T00:00:00Z"
                        }}
                    }
                }}
            };

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

    queryData := map[string]interface{}{
        "filter": []interface{}{
            map[string]interface{}{
                "country": map[string]interface{}{
                    "equals": "USA",
                },
            },
        },
        "query": []interface{}{
            map[string]interface{}{
                "purchased-products": 2,
                "between": []interface{}{
                    "2017-05-16T00:00:00Z",
                    "2017-06-04T00:00:00Z",
                },
            },
        },
    }

    fmt.Println(slicingdice.Aggregation(queryData))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "result": {
        "purchased-products": [
            {
                "quantity": 1084,
                "value": "Laptop"
            }, {
                "quantity": 842,
                "value": "Mobile phone"
            }
        ]
    },
    "took": 0.103
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object, like the example above, containing a filter (optional) and a query containing a list of columns and predicates.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/aggregation endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/aggregation endpoint:

Operation
Limits

Request rate limit

  • At most 1,200 requests per minute (20 requests per second), according to the Query Load plan selected for the database.
  • At most 1 queries per request.
  • At most 5 columns per query.

Query Interval Resolution

Interval resolutions for event columns of seconds and minutes can be used only for the past 24 hours, whereas intervals of hours can be used for the past 30 days. Intervals with resolution of days can be always used.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/aggregation endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/aggregation endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/aggregation endpoint.

Suggest Edits

POST /top_values

Endpoint purpose: retrieves the most popular stored values for one column for the given database, according to the Database key.

 
posthttps://api.slicingdice.com/v1/query/top_values
curl -X POST https://api.slicingdice.com/v1/query/top_values \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "name-contains-eff": {
            "name": 3,
            "contains": [
                "eff"
            ],
            "dimension": "users"
        }
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

query_data = {
    "name-contains-eff": {
        "dimension": "users",
        "contains": [
            "eff"
        ],
        "name": 3
    }
}

print(slicingdice.top_values(query_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 queryData = new JSONObject()
        .put("name-contains-eff", new JSONObject()
            .put("dimension", "users")
            .put("contains", new JSONArray()
                .put("eff"))
            .put("name", 3));
        JSONObject result = slicingdice.topValues(queryData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

query_data = {
    "name-contains-eff" => {
      "dimension" => "users",
        "contains" => [
            "eff"
        ],
        "name" => 3
    }
}

puts slicingdice.top_values(query_data)
const SlicingDice = require('slicerjs');

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

const queryData = {
    "name-contains-eff": {
        "dimension": "users",
        "contains": [
            "eff"
        ],
        "name": 3
    }
};

slicingdice.topValues(queryData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$queryData = array(
    "name-contains-eff" => array(
        "dimension" => "users",
        "contains" => array(
            "eff"
        ),
        "name" => 3
    )
);

print_r($slicingdice->topValues($queryData));
?>
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 queryData = new Dictionary<string, dynamic>{
                {"name-contains-eff", new Dictionary<string, dynamic>{
                    {"dimension", "users"},
                    {"contains", new List<dynamic>{
                        "eff"
                    }},
                    {"name", 3}
                }}
            };

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

    queryData := map[string]interface{}{
        "name-contains-eff": map[string]interface{}{
            "dimension": "users",
            "contains": []interface{}{
                "eff",
            },
            "name": 3,
        },
    }

    fmt.Println(slicingdice.TopValues(queryData))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "result": {
        "name-contains-eff": {
            "name": [
                {
                    "value": "jeff",
                    "quantity": 5
                }, {
                    "value": "geffrey",
                    "quantity": 3
                }, {
                    "value": "effen",
                    "quantity": 1
                }
            ]
        }
    },
    "took": 0.103
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object of queries identified by unique names as keys, each containing a column and a condition.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/top_values endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/top_values endpoint:

Operation
Limits

Request rate limit

  • At most 1,200 requests per minute (20 requests per second), according to the Query Load plan selected for the database.
  • At most 5 queries per request.
  • At most 5 columns per query.

Predicate parameter

At most 5 values in each predicate parameter. However, if the query element has multiple columns, predicate must have only one element.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/top_values endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/top_values endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/top_values endpoint.

Suggest Edits

POST /query/exists/entity

Endpoint purpose: checks whether a list of entity IDs exist in given database, according to the Database key.

 
posthttps://api.slicingdice.com/v1/query/exists/entity
curl -X POST https://api.slicingdice.com/v1/query/exists/entity \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "ids": [
            "user1@slicingdice.com",
            "user2@slicingdice.com",
            "user3@slicingdice.com",
            "user4@slicingdice.com",
            "user5@slicingdice.com"
        ],
        "dimension": "users"
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

dimension = "users"
query_data = [
        "user1@slicingdice.com", 
        "user2@slicingdice.com", 
        "user3@slicingdice.com", 
        "user4@slicingdice.com", 
        "user5@slicingdice.com"
]

print(slicingdice.exists_entity(query_data, dimension=dimension))
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");

        String dimension = "users";
        JSONArray queryData = new JSONArray()
        .put("user1@slicingdice.com")
        .put("user2@slicingdice.com")
        .put("user3@slicingdice.com")
        .put("user4@slicingdice.com")
        .put("user5@slicingdice.com");
      
        JSONObject result = slicingdice.existsEntity(queryData, dimension);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

dimension = "users"
query_data = [
        "user1@slicingdice.com", 
        "user2@slicingdice.com", 
        "user3@slicingdice.com", 
        "user4@slicingdice.com", 
        "user5@slicingdice.com"
]

puts slicingdice.exists_entity(query_data, dimension=dimension)
const SlicingDice = require('slicerjs');

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

const dimension = "users";
const queryData = [
    "user1@slicingdice.com", 
    "user2@slicingdice.com", 
    "user3@slicingdice.com", 
    "user4@slicingdice.com", 
    "user5@slicingdice.com"
];

slicingdice.existsEntity(queryData, dimension).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$dimension = "users";
$queryData = array(
    "user1@slicingdice.com", 
    "user2@slicingdice.com", 
    "user3@slicingdice.com", 
    "user4@slicingdice.com", 
    "user5@slicingdice.com"
);

print_r($slicingdice->existsEntity($queryData, $dimension));
?>
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");

            string dimension = "users";
            var queryData = new List<string>{
                "user1@slicingdice.com", 
                "user2@slicingdice.com", 
                "user3@slicingdice.com", 
                "user4@slicingdice.com", 
                "user5@slicingdice.com"
            };

            var result = slicingdice.ExistsEntity(queryData, dimension);
            System.Console.WriteLine(JsonConvert.SerializeObject(result).ToString());
        }
    }
}
tablepackage 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)

    dimension := "users"
    queryData := []string {
        "user1@slicingdice.com",
        "user2@slicingdice.com",
        "user3@slicingdice.com",
        "user4@slicingdice.com",
        "user5@slicingdice.com",
    }

    fmt.Println(slicingdice.ExistsEntity(queryData, dimension))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "exists": [
        "user1@slicingdice.com",
        "user3@slicingdice.com",
        "user4@slicingdice.com"
    ],
    "not-exists": [
        "user2@slicingdice.com",
        "user5@slicingdice.com"
    ],
    "took": 0.055
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object containing a list of entity IDs (ids) and the table you want to check.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/exists/entity endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/exists/entity endpoint:

Operation
Limits

Request rate limit

  • At most 1,200 requests per minute (20 requests per second), according to the Query Load plan selected for the database.
  • At most 100 IDs per request.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/exists/entity endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/exists/entity endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/exists/entity endpoint.

Suggest Edits

POST /data_extraction/result

Endpoint purpose: retrieve data from stored entities for the given query.

 
posthttps://api.slicingdice.com/v1/data_extraction/result
curl -X POST https://api.slicingdice.com/v1/data_extraction/result \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "query": [
            {
                "state": { "equals": "NY" }
            },
            "or",
            {
                "state": { "equals": "CA" }
            }
        ],
        "columns": [
            "city",
            "state"
        ],
        "limit": 3
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

query_data = {
    "query": [
        {
            "state": {
                "equals": "NY"
            }
        }, 
        "or", 
        {
            "state": {
                "equals": "CA"
            }
        }
    ],
    "limit": 3,
    "columns": [
        "city", 
        "state"
    ]
}

print(slicingdice.result(query_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 queryData = new JSONObject()
        .put("query", new JSONArray()
            .put(new JSONObject()
                .put("state", new JSONObject()
                    .put("equals", "NY")))
            .put("or")
            .put(new JSONObject()
                .put("state", new JSONObject()
                    .put("equals", "CA"))))
        .put("limit", 3)
        .put("columns", new JSONArray()
            .put("city")
            .put("state"));
        JSONObject result = slicingdice.result(queryData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

query_data = {
    "query" => [
        {
            "state" => {
                "equals" => "NY"
            }
        }, 
        "or", 
        {
            "state" => {
                "equals" => "CA"
            }
        }
    ],
    "limit" => 3,
    "columns" => [
        "city", 
        "state"
    ]
}

puts slicingdice.result(query_data)
const SlicingDice = require('slicerjs');

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

const queryData = {
    "query": [
        {
            "state": {
                "equals": "NY"
            }
        }, 
        "or", 
        {
            "state": {
                "equals": "CA"
            }
        }
    ],
    "limit": 3,
    "columns": [
        "city", 
        "state"
    ]
};

slicingdice.result(queryData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$queryData = array(
    "query" => array(
        array(
            "state" => array(
                "equals" => "NY"
            )
        ), 
        "or", 
        array(
            "state" => array(
                "equals" => "CA"
            )
        )
    ),
    "limit" => 3,
    "columns" => array(
        "city", 
        "state"
    )
);

print_r($slicingdice->result($queryData));
?>
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 queryData = new Dictionary<string, dynamic>{
                {"query", new List<dynamic>{
                    new Dictionary<string, dynamic>{
                        {"state", new Dictionary<string, dynamic>{
                            {"equals", "NY"}
                        }}
                    }, 
                    "or", 
                    new Dictionary<string, dynamic>{
                        {"state", new Dictionary<string, dynamic>{
                            {"equals", "CA"}
                        }}
                    }
                }},
                {"limit", 3},
                {"columns", new List<dynamic>{
                    "city", 
                    "state"
                }}
            };

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

    queryData := map[string]interface{}{
        "query": []interface{}{
            map[string]interface{}{
                "state": map[string]interface{}{
                    "equals": "NY",
                },
            },
            "or",
            map[string]interface{}{
                "state": map[string]interface{}{
                    "equals": "CA",
                },
            },
        },
        "limit": 3,
        "columns": []interface{}{
            "city",
            "state",
        },
    }

    fmt.Println(slicingdice.Result(queryData))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "data": {
        "customer1@mycustomer.com": {
            "city": "New York",
            "state": "NY"
        },
        "customer2@mycustomer.com": {
            "city": "San Diego",
            "state": "CA"
        },
        "customer5@mycustomer.com": {
            "city": "Los Angeles",
            "state": "CA"
        }
    },
    "page": 1,
    "next-page": 2,
    "page-token": "5bD37Hbv56cHHfbWx68N",
    "took": 0.232
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object containing your query and the columns you want to retrieve from SlicingDice.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /data_extraction/result endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /data_extraction/result endpoint:

Operation
Limits

Request rate limit

  • At most 10 requests per minute.
  • At most 10 columns per request.

Pagination

At most 1,024 entities per page.

Event columns

Data extraction can only retrieve data from attribute columns, which are defined in the columns parameter. However, event columns can be used to filter entities in the query parameter.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /data_extraction/result endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /data_extraction/result endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /data_extraction/result endpoint.

Check also the query demo tool we created, so you can easily understand how to query your data on SlicingDice, or use this tool to validate if an existing JSON query command is valid/correct.

Suggest Edits

POST /data_extraction/score

Endpoint purpose: retrieve data from stored entities with its relevance score for the given query.

 
posthttps://api.slicingdice.com/v1/data_extraction/score
curl -X POST https://api.slicingdice.com/v1/data_extraction/score \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "query": [
            {
                "state": { "equals": "NY" }
            },
            "or",
            {
                "state": { "equals": "CA" }
            },
            "or",
            {
                "gender": { "equals": "male" }
            },
            "or",
            {
                "age": { "range": [ 18, 25 ] }
            }
        ],
        "columns": [
            "city",
            "state"
        ],
        "limit": 3
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

query_data = {
    "query": [
        {
            "state": {
                "equals": "NY"
            }
        }, 
        "or", 
        {
            "state": {
                "equals": "CA"
            }
        }, 
        "or", 
        {
            "gender": {
                "equals": "male"
            }
        }, 
        "or", 
        {
            "age": {
                "range": [
                    18, 
                    25
                ]
            }
        }
    ],
    "limit": 3,
    "columns": [
        "city", 
        "state"
    ]
}

print(slicingdice.score(query_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 queryData = new JSONObject()
        .put("query", new JSONArray()
            .put(new JSONObject()
                .put("state", new JSONObject()
                    .put("equals", "NY")))
            .put("or")
            .put(new JSONObject()
                .put("state", new JSONObject()
                    .put("equals", "CA")))
            .put("or")
            .put(new JSONObject()
                .put("gender", new JSONObject()
                    .put("equals", "male")))
            .put("or")
            .put(new JSONObject()
                .put("age", new JSONObject()
                    .put("range", new JSONArray()
                        .put(18)
                        .put(25)))))
        .put("limit", 3)
        .put("columns", new JSONArray()
            .put("city")
            .put("state"));
        JSONObject result = slicingdice.score(queryData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

query_data = {
    "query" => [
        {
            "state" => {
                "equals" => "NY"
            }
        }, 
        "or", 
        {
            "state" => {
                "equals" => "CA"
            }
        }, 
        "or", 
        {
            "gender" => {
                "equals" => "male"
            }
        }, 
        "or", 
        {
            "age" => {
                "range" => [
                    18, 
                    25
                ]
            }
        }
    ],
    "limit" => 3,
    "columns" => [
        "city", 
        "state"
    ]
}

puts slicingdice.score(query_data)
const SlicingDice = require('slicerjs');

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

const queryData = {
    "query": [
        {
            "state": {
                "equals": "NY"
            }
        }, 
        "or", 
        {
            "state": {
                "equals": "CA"
            }
        }, 
        "or", 
        {
            "gender": {
                "equals": "male"
            }
        }, 
        "or", 
        {
            "age": {
                "range": [
                    18, 
                    25
                ]
            }
        }
    ],
    "limit": 3,
    "columns": [
        "city", 
        "state"
    ]
};

slicingdice.score(queryData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$queryData = array(
    "query" => array(
        array(
            "state" => array(
                "equals" => "NY"
            )
        ), 
        "or", 
        array(
            "state" => array(
                "equals" => "CA"
            )
        ), 
        "or", 
        array(
            "gender" => array(
                "equals" => "male"
            )
        ), 
        "or", 
        array(
            "age" => array(
                "range" => array(
                    18, 
                    25
                )
            )
        )
    ),
    "limit" => 3,
    "columns" => array(
        "city", 
        "state"
    )
);

print_r($slicingdice->score($queryData));
?>
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 queryData = new Dictionary<string, dynamic>{
                {"query", new List<dynamic>{
                    new Dictionary<string, dynamic>{
                        {"state", new Dictionary<string, dynamic>{
                            {"equals", "NY"}
                        }}
                    }, 
                    "or", 
                    new Dictionary<string, dynamic>{
                        {"state", new Dictionary<string, dynamic>{
                            {"equals", "CA"}
                        }}
                    }, 
                    "or", 
                    new Dictionary<string, dynamic>{
                        {"gender", new Dictionary<string, dynamic>{
                            {"equals", "male"}
                        }}
                    }, 
                    "or", 
                    new Dictionary<string, dynamic>{
                        {"age", new Dictionary<string, dynamic>{
                            {"range", new List<dynamic>{
                                18, 
                                25
                            }}
                        }}
                    }
                }},
                {"limit", 3},
                {"columns", new List<dynamic>{
                    "city", 
                    "state"
                }}
            };

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

    queryData := map[string]interface{}{
        "query": []interface{}{
            map[string]interface{}{
                "state": map[string]interface{}{
                    "equals": "NY",
                },
            },
            "or",
            map[string]interface{}{
                "state": map[string]interface{}{
                    "equals": "CA",
                },
            },
            "or",
            map[string]interface{}{
                "gender": map[string]interface{}{
                    "equals": "male",
                },
            },
            "or",
            map[string]interface{}{
                "age": map[string]interface{}{
                    "range": []interface{}{
                        18,
                        25,
                    },
                },
            },
        },
        "limit": 3,
        "columns": []interface{}{
            "city",
            "state",
        },
    }

    fmt.Println(slicingdice.Result(Score))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "data": {
        "user1": {
            "city": "New York",
            "state": "NY",
            "score": 2
            // +1 for living in NY
            // +1 for being in the age range
        },
        "user2": {
            "city": "San Diego",
            "state": "CA",
            "score": 1
            // +1 for living in CA
        },
        "user4": {
            "city": "Seattle"
            "state": "WA",
            "score": 3
            // +1 for living in WA
            // +1 for being male
            // +1 for being in the age range
        },
        "user5": {
            "city": "Los Angeles",
            "state": "CA",
            "score": 2
            // +1 for living in CA
            // +1 for being in the age range
        }
    },
    "page": 1,
    "next-page": null,
    "took": 0.093
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object containing your query and the columns you want to retrieve from SlicingDice.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /data_extraction/score endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /data_extraction/score endpoint:

Operation
Limits

Request rate limit

  • At most 10 requests per minute.
  • At most 10 columns per request.

Pagination

At most 1,024 entities per page.

Event columns

Data extraction can only retrieve data from attribute columns, which are defined in the columns parameter. However, event columns can be used to filter entities in the query parameter.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /data_extraction/score endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /data_extraction/score endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /data_extraction/score endpoint.

Check also the query demo tool we created, so you can easily understand how to query your data on SlicingDice, or use this tool to validate if an existing JSON query command is valid/correct.

Suggest Edits

POST /query/count/entity/total

Endpoint purpose: retrieve the number of entities stored in the database so far, according to the Database key.

 
posthttps://api.slicingdice.com/v1/query/count/entity/total
curl -X POST https://api.slicingdice.com/v1/query/count/entity/total \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{}'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

print(slicingdice.count_entity_total())
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 result = slicingdice.countEntityTotal();
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

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

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

slicingdice.countEntityTotal().then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

print_r($slicingdice->countEntityTotal());
?>
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 result = slicingdice.CountEntityTotal();
            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)

    fmt.Println(slicingdice.CountEntityTotal())
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "result": {
        "total": 340
    },
    "took": 0.103
}

Body Params

Request Body
string

The body of the request is expected to have one JSON object containing a list of tables (will count all entities in the whole database if tables is omitted).

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/count/entity/total endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/count/entity/total endpoint:

Operation
Limits

Request rate limit

At most 1,200 requests per minute (20 requests per second), according to the Query Load plan selected for the database.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/count/entity/total endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/count/entity/total endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/count/entity/total endpoint.

Suggest Edits

GET /query/count/entity/total

 
gethttps://api.slicingdice.com/v1/query/count/entity/total
curl -X GET https://api.slicingdice.com/v1/query/count/entity/total \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

print(slicingdice.count_entity_total())
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 result = slicingdice.countEntityTotal();
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

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

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

slicingdice.countEntityTotal().then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

print_r($slicingdice->countEntityTotal());
?>
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 result = slicingdice.CountEntityTotal();
            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)

    fmt.Println(slicingdice.CountEntityTotal())
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "result": {
        "total": 340
    },
    "took": 0.123
}

Body Params

Request Body
string

The body of the request doesn't expect any data because it executes the count total query considering all dimensions for a given database.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/count/entity/total endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/count/entity/total endpoint:

Operations
Limits

Request rate limit

At most 1,200 requests per minute (20 requests per second), according to the Query Load plan selected for the database.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/count/entity/total endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/count/entity/total endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/count/entity/total endpoint.

Suggest Edits

POST /column

Endpoint purpose: create new column to store data in a given database, according to the Database key.

 
posthttps://api.slicingdice.com/v1/column
curl -X POST https://api.slicingdice.com/v1/column \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '[
        {
            "name": "User State",
            "api-name": "state",
            "type": "string",
            "description": "State where the user lives",
            "storage": "latest-value"
        }, {
            "name": "User Age",
            "api-name": "age",
            "type": "integer",
            "storage": "latest-value"
        }
    ]'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = [
    {
        "type": "string",
        "storage": "latest-value",
        "api-name": "state",
        "name": "User State",
        "description": "State where the user lives"
    }, 
    {
        "type": "integer",
        "storage": "latest-value",
        "api-name": "age",
        "name": "User Age"
    }
]
print(slicingdice.create_column(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");

        JSONArray insertData = new JSONArray()
        .put(new JSONObject()
            .put("type", "string")
            .put("storage", "latest-value")
            .put("api-name", "state")
            .put("name", "User State")
            .put("description", "State where the user lives"))
        .put(new JSONObject()
            .put("type", "integer")
            .put("storage", "latest-value")
            .put("api-name", "age")
            .put("name", "User Age"));
        JSONObject result = slicingdice.createColumn(insertData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

insert_data = [
    {
        "type" => "string",
        "storage" => "latest-value",
        "api-name" => "state",
        "name" => "User State",
        "description" => "State where the user lives"
    }, 
    {
        "type" => "integer",
        "storage" => "latest-value",
        "api-name" => "age",
        "name" => "User Age"
    }
]
puts slicingdice.create_column(insert_data)
const SlicingDice = require('slicerjs');

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

const insertData = [
    {
        "type": "string",
        "storage": "latest-value",
        "api-name": "state",
        "name": "User State",
        "description": "State where the user lives"
    }, 
    {
        "type": "integer",
        "storage": "latest-value",
        "api-name": "age",
        "name": "User Age"
    }
];

slicingdice.createColumn(insertData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$insertData = array(
    array(
        "type" => "string",
        "storage" => "latest-value",
        "api-name" => "state",
        "name" => "User State",
        "description" => "State where the user lives"
    ), 
    array(
        "type" => "integer",
        "storage" => "latest-value",
        "api-name" => "age",
        "name" => "User Age"
    )
);

print_r($slicingdice->createColumn($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 List<dynamic>{
                new Dictionary<string, dynamic>{
                    {"type", "string"},
                    {"storage", "latest-value"},
                    {"api-name", "state"},
                    {"name", "User State"},
                    {"description", "State where the user lives"}
                }, 
                new Dictionary<string, dynamic>{
                    {"type", "integer"},
                    {"storage", "latest-value"},
                    {"api-name", "age"},
                    {"name", "User Age"}
                }
            };

            var result = slicingdice.createColumn(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 := []interface{}{
        map[string]interface{}{
            "type": "string",
            "storage": "latest-value",
            "api-name": "state",
            "name": "User State",
            "description": "State where the user lives",
        },
        map[string]interface{}{
            "type": "integer",
            "storage": "latest-value",
            "api-name": "age",
            "name": "User Age",
        },
    }

    fmt.Println(slicingdice.createColumn(insertData))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "api-name": [
        "state", "age"
    ]
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object, like the example above, where the keys are entity IDs and values are other JSON objects containing data for that entity.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /column endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /column endpoint:

Operation
Limits

Request rate limit

  • At most 600 requests per minute (10 requests per second).
  • At most 100 columns per request.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /column endpoint accepts: Master Key, Write Key or a Custom Database Key configured as write-read or write-only key.

You can also use the demo Database Key to create or list columns on a test database.

Errors

Access this page for the full list of all possible errors related to the /column endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /column endpoint.

Check also the column creation tool we built, so you can easily understand how to create any type of columns on SlicingDice.

Suggest Edits

GET /column

Endpoint purpose: get metadata of all columns for the database accessible by the given Database key.

 
gethttps://api.slicingdice.com/v1/column
curl -X GET https://api.slicingdice.com/v1/column \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

print(slicingdice.get_columns())
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 result = slicingdice.getColumns();
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

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

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

slicingdice.getColumns().then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

print_r($slicingdice->getColumns());
?>
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 result = slicingdice.getColumns();
            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)

    fmt.Println(slicingdice.getColumns())
}
A binary file was returned

You couldn't be authenticated

{
  "status": "success",
  "count": 3,
  "users": {
    "active": [
      {
        "name": "entity-id",
        "api-name": "entity-id",
        "description": "",
        "type": "unique-id",
        "category": "general",
        "storage": "latest-value"
      },
      {
        "name": "User State",
        "api-name": "state",
        "description": "State where the user lives",
        "type": "string",
        "category": "general",
        "storage": "latest-value"
      }
    ],
    "inactive": [
      {
        "name": "User Age",
        "api-name": "age",
        "description": "Age of the user",
        "type": "integer",
        "category": "general",
        "storage": "latest-value"
      }
    ]
  },
  "took": 0.026
}

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /column endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /column endpoint:

Operation
Limits

Request rate limit

At most 600 requests per minute (10 requests per second).

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /column endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to create or list columns on a test database.

Errors

Access this page for the full list of all possible errors related to the /column endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /column endpoint.

Check also the column creation tool we built, so you can easily understand how to create any type of columns on SlicingDice.

Suggest Edits

POST /query/saved

Endpoint purpose: create a new saved query.

 
posthttps://api.slicingdice.com/v1/query/saved
curl -X POST https://api.slicingdice.com/v1/query/saved \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "name": "my-saved-query",
        "type": "count/entity",
        "query": [
            {
                "state": {
                    "equals": "NY"
                }
            },
            "or",
            {
                "state": {
                    "equals": "CA"
                }
            }
        ],
        "dimension": "users"
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

query_data = {
    "query": [
        {
            "state": {
                "equals": "NY"
            }
        }, 
        "or", 
        {
            "state": {
                "equals": "CA"
            }
        }
    ],
    "type": "count/entity",
    "name": "my-saved-query",
    "dimension": "users"
}

print(slicingdice.create_saved_query(query_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 queryData = new JSONObject()
        .put("query", new JSONArray()
            .put(new JSONObject()
                .put("state", new JSONObject()
                    .put("equals", "NY")))
            .put("or")
            .put(new JSONObject()
                .put("state", new JSONObject()
                    .put("equals", "CA"))))
        .put("type", "count/entity")
        .put("name", "my-saved-query")
        .put("dimension", "users");
        JSONObject result = slicingdice.createSavedQuery(queryData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

query_data = {
    "query" => [
        {
            "state" => {
                "equals" => "NY"
            }
        }, 
        "or", 
        {
            "state" => {
                "equals" => "CA"
            }
        }
    ],
    "type" => "count/entity",
    "name" => "my-saved-query",
    "dimension" => "users"
}

puts slicingdice.create_saved_query(query_data)
const SlicingDice = require('slicerjs');

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

const queryData = {
    "query": [
        {
            "state": {
                "equals": "NY"
            }
        }, 
        "or", 
        {
            "state": {
                "equals": "CA"
            }
        }
    ],
    "type": "count/entity",
    "name": "my-saved-query",
    "dimension": "users"
};

slicingdice.createSavedQuery(queryData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$queryData = array(
    "query" => array(
        array(
            "state" => array(
                "equals" => "NY"
            )
        ), 
        "or", 
        array(
            "state" => array(
                "equals" => "CA"
            )
        )
    ),
    "type" => "count/entity",
    "name" => "my-saved-query",
    "dimension" => "users"
);

print_r($slicingdice->createSavedQuery($queryData));
?>
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 queryData = new Dictionary<string, dynamic>{
                {"query", new List<dynamic>{
                    new Dictionary<string, dynamic>{
                        {"state", new Dictionary<string, dynamic>{
                            {"equals", "NY"}
                        }}
                    }, 
                    "or", 
                    new Dictionary<string, dynamic>{
                        {"state", new Dictionary<string, dynamic>{
                            {"equals", "CA"}
                        }}
                    }
                }},
                {"type", "count/entity"},
                {"name", "my-saved-query"},
                {"dimension", "users"}
            };

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

    queryData := map[string]interface{}{
        "query": []interface{}{
            map[string]interface{}{
                "state": map[string]interface{}{
                    "equals": "NY",
                },
            },
            "or",
            map[string]interface{}{
                "state": map[string]interface{}{
                    "equals": "CA",
                },
            },
        },
        "type": "count/entity",
        "name": "my-saved-query",
        "dimension": "users",
    }

    fmt.Println(slicingdice.CreateSavedQuery(queryData))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "name": "my-saved-query",
    "type": "count/entity",
    "query": [
        {
            "state": {
                "equals": "ny"
            }
        },
        "or",
        {
            "state": {
                "equals": "ca"
            }
        }
    ],
    "dimension": "users",
    "cache-period": 60,
    "took": 0.17
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object, containing a name, its type and the query itself. Since the name will be used in the query URL, only alphanumeric a-zA-Z0-9 and - characters are allowed.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/saved endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/saved endpoint:

Operation
Limits

Request rate limit

  • At most 60 requests per minute (1 request per second).
  • Same limits as the query being executed.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/saved endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/saved endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/saved endpoint.

Check also the query demo tool we created, so you can easily understand how to query your data on SlicingDice, or use this tool to validate if an existing JSON query command is valid/correct.

Suggest Edits

GET /query/saved

Endpoint purpose: get metadata for all saved queries.

 
gethttps://api.slicingdice.com/v1/query/saved
curl -X GET https://api.slicingdice.com/v1/query/saved \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

print(slicingdice.get_saved_queries())
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 result = slicingdice.getSavedQueries();
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

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

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

slicingdice.getSavedQueries().then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

print_r($slicingdice->getSavedQueries());
?>
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 result = slicingdice.GetSavedQueries();
            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)

    fmt.Println(slicingdice.GetSavedQueries())
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "saved-queries": [
        {
            "name": "my-saved-query",
            "type": "count/entity",
            "query": [
                {
                    "state": {
                        "equals": "ny"
                    }
                },
                "or",
                {
                    "state": {
                        "equals": "ca"
                    }
                }
            ],
            "cache-period": 60,
            "dimension": "users"
        }
    ],
    "took": 0.029
}

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/saved endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/saved endpoint:

Operation
Limits

Request rate limit

  • At most 600 requests per minute (10 requests per second).

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/saved endpoint accepts: Master Key, Read Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/saved endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/saved endpoint.

Check also the query demo tool we created, so you can easily understand how to query your data on SlicingDice, or use this tool to validate if an existing JSON query command is valid/correct.

Suggest Edits

PUT /query/saved/:query_name

Endpoint purpose: update an existing saved query.

 
puthttps://api.slicingdice.com/v1/query/saved/:query_name
curl -X PUT https://api.slicingdice.com/v1/query/saved/my-saved-query \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "type": "count/entity",
        "query": [
            {
                "state": {
                    "equals": "NY"
                }
            },
            "or",
            {
                "state": {
                    "equals": "CA"
                }
            }
        ],
        "dimension": "users"
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

query_data = {
    "query": [
        {
            "state": {
                "equals": "NY"
            }
        }, 
        "or", 
        {
            "state": {
                "equals": "CA"
            }
        }
    ],
    "type": "count/entity",
    "dimension": "users"
}

print(slicingdice.update_saved_query("my-saved-query", query_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 queryData = new JSONObject()
        .put("query", new JSONArray()
            .put(new JSONObject()
                .put("state", new JSONObject()
                    .put("equals", "NY")))
            .put("or")
            .put(new JSONObject()
                .put("state", new JSONObject()
                    .put("equals", "CA"))))
        .put("type", "count/entity")
        .put("dimension", "users");
      
        JSONObject result = slicingdice.updateSavedQuery("my-saved-query", queryData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

query_data = {
    "query" => [
        {
            "state" => {
                "equals" => "NY"
            }
        }, 
        "or", 
        {
            "state" => {
                "equals" => "CA"
            }
        }
    ],
    "type" => "count/entity",
    "dimension" => "users"
}

puts slicingdice.update_saved_query("my-saved-query", query_data)
const SlicingDice = require('slicerjs');

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

const queryData = {
    "query": [
        {
            "state": {
                "equals": "NY"
            }
        }, 
        "or", 
        {
            "state": {
                "equals": "CA"
            }
        }
    ],
    "type": "count/entity",
    "dimension": "users"
};

slicingdice.updateSavedQuery("my-saved-query", queryData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

$queryData = array(
    "query" => array(
        array(
            "state" => array(
                "equals" => "NY"
            )
        ), 
        "or", 
        array(
            "state" => array(
                "equals" => "CA"
            )
        )
    ),
    "type" => "count/entity",
    "dimension" => "users"
);

print_r($slicingdice->updateSavedQuery("my-saved-query", $queryData));
?>
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 queryData = new Dictionary<string, dynamic>{
                {"query", new List<dynamic>{
                    new Dictionary<string, dynamic>{
                        {"state", new Dictionary<string, dynamic>{
                            {"equals", "NY"}
                        }}
                    }, 
                    "or", 
                    new Dictionary<string, dynamic>{
                        {"state", new Dictionary<string, dynamic>{
                            {"equals", "CA"}
                        }}
                    }
                }},
                {"type", "count/entity"},
                {"dimension", "users"}
            };

            var result = slicingdice.UpdateSavedQuery("my-saved-query", queryData);
            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)

    queryData := map[string]interface{}{
        "query": []interface{}{
            map[string]interface{}{
                "state": map[string]interface{}{
                    "equals": "NY",
                },
            },
            "or",
            map[string]interface{}{
                "state": map[string]interface{}{
                    "equals": "CA",
                },
            },
        },
        "type": "count/entity",
        "dimension": "users",
    }

    fmt.Println(slicingdice.UpdateSavedQuery("my-saved-query", queryData))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "type": "count/entity",
    "query": [
        {
            "state": {
                "equals": "ny"
            }
        },
        "or",
        {
            "state": {
                "equals": "ca"
            }
        }
    ],
    "cache-period": 60,
    "took": 0.169
}

Body Params

Request Body
json
required

The body of the request is expected to have one JSON object, containing a name, its type and the query itself. Since the name will be used in the query URL, only alphanumeric a-zA-Z0-9 and - characters are allowed.

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/saved endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/saved endpoint:

Operation
Limits

Request rate limit

  • At most 60 requests per minute (1 request per second).
  • Same limits as the query being executed.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/saved endpoint accepts: Master Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/saved endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/saved endpoint.

Check also the query demo tool we created, so you can easily understand how to query your data on SlicingDice, or use this tool to validate if an existing JSON query command is valid/correct.

Suggest Edits

GET /query/saved/:query_name

Endpoint purpose: update an existing saved query.

 
gethttps://api.slicingdice.com/v1/query/saved/:query_name
curl -X GET https://api.slicingdice.com/v1/query/saved/my-saved-query \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

print(slicingdice.get_saved_query("my-saved-query"))
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 result = slicingdice.getSavedQuery("my-saved-query");
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

puts slicingdice.get_saved_query("my-saved-query")
const SlicingDice = require('slicerjs');

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

slicingdice.getSavedQueries("my-saved-query").then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

print_r($slicingdice->getSavedQuery("my-saved-query"));
?>
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 result = slicingdice.GetSavedQuery("my-saved-query");
            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)

    fmt.Println(slicingdice.GetSavedQuery("my-saved-query"))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "type": "count/entity",
    "query": [
        {
            "state": {
                "equals": "ny"
            }
        },
        "or",
        {
            "state": {
                "equals": "ca"
            }
        }
    ],
    "dimension": "users",
    "result": 42,
    "took": 0.151
}

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/saved endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/saved endpoint:

Operation
Limits

Request rate limit

  • Same limits as the query being executed.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/saved endpoint accepts: Master Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to query data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/saved endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/saved endpoint.

Check also the query demo tool we created, so you can easily understand how to query your data on SlicingDice, or use this tool to validate if an existing JSON query command is valid/correct.

Suggest Edits

DELETE /query/saved/:query_name

Endpoint purpose: update an existing saved query.

 
deletehttps://api.slicingdice.com/v1/query/saved/:query_name
curl -X DELETE https://api.slicingdice.com/v1/query/saved/my-saved-query \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

print(slicingdice.delete_saved_query("my-saved-query"))
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 result = slicingdice.deleteSavedQuery("my-saved-query");
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY')

puts slicingdice.delete_saved_query("my-saved-query")
const SlicingDice = require('slicerjs');

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

slicingdice.deleteSavedQuery("my-saved-query").then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));

print_r($slicingdice->deleteSavedQuery("my-saved-query"));
?>
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 result = slicingdice.DeleteSavedQuery("my-saved-query");
            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)

    fmt.Println(slicingdice.DeleteSavedQuery("my-saved-query"))
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "took": 0.06,
    "cache-period": 60,
    "deleted-query": "my-saved-query",
    "query": [
        {
            "state": {
                "equals": "ny"
            }
        },
        "or",
        {
            "state": {
                "equals": "ca"
            }
        }
    ],
    "type": "count\/entity"
}

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /query/saved endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /query/saved endpoint:

Operation
Limits

Request rate limit

  • Same limits as the query being executed.

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /query/saved endpoint accepts: Master Key or a Custom Database Key configured as write-read or read-only key.

You can also use the demo Database Key to delete data on a test database.

Errors

Access this page for the full list of all possible errors related to the /query/saved endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /query/saved endpoint.

Check also the query demo tool we created, so you can easily understand how to query your data on SlicingDice, or use this tool to validate if an existing JSON query command is valid/correct.

Suggest Edits

GET /database

Endpoint purpose: get metadata of the database for a given Database key.

 
gethttps://api.slicingdice.com/v1/database
curl -X GET https://api.slicingdice.com/v1/database \
    -H 'Authorization: MASTER_API_KEY' \
    -H 'Content-Type: application/json'
from pyslicer import SlicingDice
slicingdice = SlicingDice('MASTER_API_KEY')
print(slicingdice.get_database())
import java.io.IOException;
import org.json.JSONObject;
import com.slicingdice.jslicer.SlicingDice;

public class Example {

    public static void main(String[] args) throws IOException {
        SlicingDice slicingDice = new SlicingDice("MASTER_API_KEY");
        JSONObject result = slicingDice.getDatabase();
        System.out.println(result.toString());
    }
}
require 'rbslicer'
client = SlicingDice.new(master_key: "MASTER_API_KEY")

puts client.get_database()
const SlicingDice = require('slicerjs');
const slicingdice = new SlicingDice({
  masterKey: 'MASTER_API_KEY'
});

slicingdice.getDatabase().then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});
<?php
use Slicer\SlicingDice;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"));
print_r($slicingdice->getDatabase());
?>
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 result = slicingdice.GetDatabase();
            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)
    fmt.Println(slicingdice.GetDatabase())
}
A binary file was returned

You couldn't be authenticated

{
    "name": "database-name",
    "description": "My first database",
    "tables": [
        "default"
    ],
    "updated-at": "2017-06-02T17:34:50.563778",
    "created-at": "2017-06-02T17:34:50.563720"
}

Headers

Authorization
string
required

All requests must contain the Authorization header with a valid database key. That's how we know you are the one using SlicingDice and also store statistics for each database usage.

Content-Type
string
required

All interactions with SlicingDice's API occur via JSON data, both for input and output. Therefore, all requests must have an HTTP header Content-Type: application/json to successfully use the API, otherwise errors will be produced.

 

HTTP methods

The /database endpoint accepts HTTPS requests only.

Limits and Restrictions

Below is the list of limits and restrictions for the /database endpoint:

Operation
Limits

Request rate limit

At most 60 requests per minute (1 requests per second).

Note that some limits, such as request rate limit, are in place just to protect the service from DDoS attacks. Should you need special arrangements, simply talk with us.

Database Keys

The /database endpoint accepts: Master Key.

Errors

Access this page for the full list of all possible errors related to the /database endpoint.

Guides / Tutorials

Below are some guides and tutorials on how to use the /database endpoint.