SDKs
We recommend using a SDK to send data to Databox’s Push API. We maintain SDKs for some of the more popular coding languages, listed below.
- PHP
- JavaScript
- Ruby
- Java
- Go
- Python
use Databox\Client;
$c = new Client('2cdt4yoytbvockc51cowgs4gsss84ow4s');
$ok = $c->push('sales', 123000);
var Databox = require('databox');
var client = new Databox({
push_token: '2cdt4yoytbvockc51cowgs4gsss84ow4s'
});
client.push({
key: 'sales',
value: 123000
}, function(response){
console.log(response);
});
Databox.configure do |c|
c.push_token = '2cdt4yoytbvockc51cowgs4gsss84ow4s'
end
client = Databox::Client.new
client.push(key: 'sales', value: 123000)
String TOKEN = "2cdt4yoytbvockc51cowgs4gsss84ow4s";
Databox databox = new Databox(TOKEN);
try {
databox.push("sales", 123000d);
} 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: 123000,
}); error != nil {
fmt.Println("Inserted.")
}
}
from databox import Client
client = Client('2cdt4yoytbvockc51cowgs4gsss84ow4s')
client.push('sales', 123000)
- PHP
- JavaScript
- Ruby
- Java
- Go
- Python
use Databox\Client;
$c = new Client('2cdt4yoytbvockc51cowgs4gsss84ow4s');
$c->insertAll([
['sales', 83000, '2018-01-19', [
'channel' => 'online'
]],
['sales', 4000, '2018-01-20 16:07:37-06:00', [
'channel' => 'retail'
]],
]);
var Databox = require('databox');
var client = new Databox({
push_token: '2cdt4yoytbvockc51cowgs4gsss84ow4s'
});
client.insertAll([
{
key: 'sales',
value: 83000,
date: '2018-01-19',
attributes: {
'channel': 'online'
}
},
{
key: 'sales',
value: 4000,
date: '2018-01-20 16:07:37-06:00',
attributes: {
'channel': 'retail'
}
}
]);
Databox.configure do |c|
c.push_token = '2cdt4yoytbvockc51cowgs4gsss84ow4s'
end
client = Databox::Client.new
client.insert_all [
{key: 'sales', value: 83000, date: '2018-01-19', attributes: {
channel: 'online'
}},
{key: 'sales', value: 4000, date: '2018-01-20 16:07:37-06:00', attributes: {
channel: 'retail'
}}
]
String TOKEN = "2cdt4yoytbvockc51cowgs4gsss84ow4s";
Databox databox = new Databox(TOKEN);
try {
List<Databox.KPI> kpis = new ArrayList<Databox.KPI>();
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")).addAttribute("channel", "online"));
kpis.add(new Databox.KPI().setKey("sales").setValue(4000).setDate(sdf.parse("2018-01-20 16:07:37-06:00")).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,
Date: time.Now().Format(time.RFC3339),
Attributes: attributes,
}); error != nil {
fmt.Println("Inserted.")
}
}
from databox import Client
client = Client('2cdt4yoytbvockc51cowgs4gsss84ow4s')
client.insert_all([
{'key': 'sales', 'value': 83000, 'date': '2018-01-19', 'attributes': {
'channel': 'online',
}},
{'key': 'sales', 'value': 4000, 'date': '2018-01-20 16:07:37-06:00', 'attributes': {
'channel': 'retail',
}},
])
More examples
SQL to Databox (Ruby)
SQL to Databox (Python)
Contributions
We welcome your contributions! Feel free to fork and improve our SDKs. If you want your own SDK added to our list, please contact us.