Send custom data to Databox

After you’ve created your Token and your first Custom Metric it’s time to start sending your custom data to Databox.

There are three ways to send your data to Databox:

  1. Using our SDKs (recommended),
  2. Using Terminal in the Databox Designer 
  3. Directly from a command line

How to send data using our SDKs
To send your custom data to Databox using our SDKs, follow these steps.

How to send data using Terminal in the Databox Designer
You can also send your custom data to Databox using the Terminal panel in the Designer.

How to send data directly from a command line:

Use the image below as a guideline when sending your custom data to Databox using a command line. 

  1. Replace the sample token in the second line <your_token>  with the Token you previously created
  2. Replace the <metric_key_id> with the metric key identifier that you previously defined.

Pro Tip: The dollar sign ($) before metric name is mandatory. If you’re using an SDK, this will be added automatically. This character is used to differentiate a metric from its attributes. Read more about metric attributes here

The example above will store the value 123.000 to the metric ‘$<metric_key_id>‘, located in the custom Data Source with the hash identification <your_token>.

By default, the current date and time (now) will be used to store information about sent events. If you would like to store events that happened in the past or will happen in the future, you can use the optional Date property. Learn more about Date and Time.

Pro Tip: A metric value must be purely numeric. For currency values, you can attach a unit to it. Percentages can be formatted directly in Databox. For duration and relative time metrics you have to push a UNIX timestamp (epoch time) in milliseconds as the metric value and then select the ‘Duration’ or ‘Relative time’ Format.

Sending multiple metrics at once

You can also send multiple metrics at once, like so:

  • cURL
curl \
-u <your_token>: \
-H 'Content-Type: application/json' \
-H 'Accept: application/vnd.databox.v2+json' \
-d '{
      "$sales": 420,
      "$visitors": 123000

Pro Tip:
If your metric is not created yet or if you used the wrong metric key identifier (i.e. ‘$sales’), the PushAPI service will create it upon first push. However, we recommend you create a metric beforehand and set the necessary parameters to avoid incorrect data presentation.

If your payload has been accepted, you will receive a 200 – OK message. If you receive an error, review this Responses and errors guide.

Once you’ve successfully sent your data, it’s time to view your data in Databox.