Page Text: Go
Python
curl https://push.databox.com \ -u 2cdt4yoytbvockc51cowgs4gsss84ow4s: \ -X POST \ -H 'Content-Type: application/json' \ -H 'Accept: application/vnd.databox.v2+json' \ -d '{ "data":[ { "$sales": 83000, "channel": "online" }, { "$sales": 4000, "channel": "retail" }, { "$sales": 123000, "$expenses": 87500, "channel": "in-person" } ] }'
use Databox\Client; $c = new Client('2cdt4yoytbvockc51cowgs4gsss84ow4s'); $c->insertAll([ ['sales', 83000, null, [ 'channel' => 'online' ]], ['sales', 4000, null, [ 'channel' => 'retail' ]], ]);
var Databox = require('databox'); var client = new Databox({ push_token: '2cdt4yoytbvockc51cowgs4gsss84ow4s' }); client.insertAll([ { key: 'sales', value: 83000, attributes: { 'channel': 'online' } }, { key: 'sales', value: 4000, attributes: { 'channel': 'retail' } } ]);
Databox.configure do |c| c.push_token = '2cdt4yoytbvockc51cowgs4gsss84ow4s' end client = Databox::Client.new client.insert_all [ {key: 'sales', value: 83000, attributes: { channel: 'online' }}, {key: 'sales', value: 4000, attributes: { channel: 'retail' }} ]
String TOKEN = "2cdt4yoytbvockc51cowgs4gsss84ow4s"; Databox databox = new Databox(TOKEN); try { List kpis = new ArrayList(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()); kpis.add(new Databox.KPI().setKey("sales").setValue(83000).addAttribute("channel", "online")); kpis.add(new Databox.KPI().setKey("sales").setValue(4000).addAttribute("channel", "retail")); databox.push(kpis); } catch (Exception e) { System.err.println(e.getLocalizedMessage()); }
package main import ( databox "github.com/databox/databox-go" "fmt" ) func main() { client := databox.NewClient("2cdt4yoytbvockc51cowgs4gsss84ow4s") var attributes = make(map[string]interface{}) attributes["channel"] = "online" if _, error := client.Push(&databox.KPI{ Key: "sales", Value: 83000, Attributes: attributes, }); error != nil { fmt.Println("Inserted.") } }
from databox import Client client = Client('2cdt4yoytbvockc51cowgs4gsss84ow4s') client.insert_all([ {'key': 'sales', 'value': 83000, 'attributes': { 'channel': 'online', }}, {'key': 'sales', 'value': 4000, 'attributes': { 'channel': 'retail', }}, ])
Pro Tip: If you send one Dimension with multiple metrics, the dimension will be added to each metric.
In Databox, you can filter and visualize your data for specific dimensions. That means you could view only retail sales, or compare sales across different channels. You can add as many dimensions as you’d like to each metric.