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, "date": "2018-01-19" }, { "$sales": 4000, "date": "2018-01-20 16:07:37-06:00" } ] }'
use Databox\Client; $c = new Client('2cdt4yoytbvockc51cowgs4gsss84ow4s'); $c->insertAll([ ['sales', 83000, '2018-01-19'], ['sales', 4000, '2018-01-20 16:07:37-06:00'], ]);
var Databox = require('databox'); var client = new Databox({ push_token: '2cdt4yoytbvockc51cowgs4gsss84ow4s' }); client.insertAll([ { key: 'sales', value: 83000, date: '2018-01-19' }, { key: 'sales', value: 4000, date: '2018-01-20 16:07:37-06:00' } ]);
Databox.configure do |c| c.push_token = '2cdt4yoytbvockc51cowgs4gsss84ow4s' end client = Databox::Client.new client.insert_all [ {key: 'sales', value: 83000, date: '2018-01-19'}, {key: 'sales', value: 4000, date: '2018-01-20 16:07:37-06:00'} ]
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).setDate(sdf.parse("2018-01-19"))); kpis.add(new Databox.KPI().setKey("sales").setValue(4000).setDate(sdf.parse("2018-01-20 16:07:37-06:00"))); 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") if _, error := client.Push(&databox.KPI{ Key: "sales", Value: 83000, Date: "2018-01-19", }); error != nil { fmt.Println("Inserted.") } }
from databox import Client client = Client('2cdt4yoytbvockc51cowgs4gsss84ow4s') client.insert_all([ {'key': 'sales', 'value': 83000, 'date': '2018-01-19'}, {'key': 'sales', 'value': 4000, 'date': '2018-01-20 16:07:37-06:00'}, ])
Dates format like ‘YYYY-MM-DD’ (i.e. 2018-01-19) will translate to 2018-01-19 00:00:00 UTC. If you omit the date parameter, the current date and time (in UTC) will be used by default. To avoid discrepancies in your data, you should double-check that all of your data has a timezone specified, or is in UTC. Learn more about time zones
2022 © Databox, Inc. All Rights Reserved.