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

2. API Details, Connection & Headers

API Connection

Most endpoints will only accept HTTPS request for security reasons, but few endpoints also accept HTTP request, as a secure connection may not be available on some cases.

API Base URL

The URL https://api.slicingdice.com/v1/ is the base of all API endpoints. Below is an example of GET /query/count/entity/total endpoint. See that the URL starts with https://api.slicingdice.com/v1/.

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

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

        JSONObject result = slicingdice.countEntityTotal();
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY', uses_test_endpoint: true)

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

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

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

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", usesTestEndpoint: true);

            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)
    slicingdice.Test = true

    fmt.Println(slicingdice.CountEntityTotal())
}

API Headers

HTTP headers are required in order to interact with the API. This section contains information on all headers accepted and required by the API.

Authentication header

All requests must contain the Authorization header with a valid Team Key or a Database Key. That's how we know you are the one using SlicingDice and also store statistics and auditing logs about SlicingDice's usage.

In the following example, MASTER_DATABASE_KEY must be replaced by a valid database API key as found in the databases page on Control Panel.

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

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_DATABASE_KEY", true);

        JSONObject result = slicingdice.countEntityTotal();
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_DATABASE_KEY', uses_test_endpoint: true)

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

const usesTestEndpoint = true;
const slicingdice = new SlicingDice({masterKey: 'MASTER_DATABASE_KEY'}, usesTestEndpoint);

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

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_DATABASE_KEY", usesTestEndpoint: true);

            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_DATABASE_KEY"
    slicingdice := slicingdice.New(keys, 60)
    slicingdice.Test = true

    fmt.Println(slicingdice.CountEntityTotal())
}

If you're using one of our clients/SDKs, there is no need to manually define the Authorization header, as you will insert the necessary key in the proper location in the SDK, defined by each SDK documentation.

Content-type header

All interactions with the 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, or errors will be produced.

If you're using one of our clients/SDKs, there is no need to manually define the Content-Type: application/json header.