It is possible to send your own data to Databoom server using HTTP requests. In order that the parameters are interpreted correctly, you must use a particular format. Follows the procedure for Python.
Parameters structure
The parameters to send must be in JSON format, in particular we use the following structure:
data_to_send = {
device: <DEVICE TOKEN>,
date: '2020-02-05T02:59:33.000+0000',
signals: []
};
device is the token of your own device, while date is the communication date (date field is no mandatory, if it's not specified, reception date is used). The token is generated by Databoom when creating the device, and can be retrieved in its detail page. signals is the array that will contain device parameters.
A signal is represented as:
{
name: <SIGNAL TOKEN>,
value: <VALUE>
};
If you want to update a signal that is already in Databoom, name must correspond to its token. If the signal is not in Databoom, it is inserted using name as token. Token value must be unique within the device.
It is also possible to forward to Databoom the values history of a signal. In this case the data format to use is:
data_to_send = {
device: <TOKEN DEVICE>,
date: '2020-02-05T02:59:33.000+0000',
signals: {}
};
Where signals is an object structured as follows:
signals : {
<SIGNAL TOKEN>: {
history: [{
date: <VALUE 1 DATE>
value: <VALUE 1>
}, {
date: <VALUE 2 DATE>
value: <VALUE 2>
...
]
},
...
};
signals can contain more signals, using their tokens as keys, and each signal may contain more values in the history array.
Data forwarding
Once the data cration has ended, it is possible to proceed with their forwarding to Databoom server. Before sending the request, its options must be setted:
oauth = 'OAUTH_TOKEN'
headers = {
'Authorization': f'Bearer {oauth}'
}
url = f'https://api.databoom.com/v1/signals/push'
OAUTH_TOKEN
is a user generated token in Databoom.
Once the options are ready, it is finally possible to proceed with the actual request:
r = requests.request(
'post',
url,
headers=headers,
json=data_to_send)
Configuration completed!
Once the procedure has been completed, Databoom starts to record data sent with HTTP. To examine your data and have a correct representation, follow the instructions in Edit/validation of a signal.
0 Comments