Online DB
+ Create API key

Index

Send data

We recommend using the Postman or Insomnia rest API client to work with the OnlineDB.NET API.
Use the following queries to store data in the OnlineDB.NET database. Please use JSON formated payload with such types: Integer, Float, String, Boolean
Send data
HTTP POST example:
https://onlinedb.net/YOUR_API_KEY/send
{"temperature":21.9, "is_motion":true, "battery_volts":4.2}
Result
{"ok":true,"id":1}

The database response in case of a positive result will be "ok": true either "error": true message with the part describing the problem. In the case of a positive result, the record identifier "id" that uniquely identifies the record will be returned
You can see your database report by opening the OnlineDB web browser https://onlinedb.net/YOUR_API_KEY/browse

Retrieve data

You can retrieve exactly the same data that you previously stored in the database. In addition to your data, there will be 2 additional fields: id and received. id identifies the record, but the field received contains the date and time when record has been created. Time format is in UTC. The last entry entered will be returned. Please use the where parameter to return multiple entries
Receive data
HTTP GET example:
https://onlinedb.net/YOUR_API_KEY/get
Result
{ "id": 9, "received": "2020-09-01 12:37:07", "temperature": 30.98, "is_motion": false, "battery_volts": 3.3 }

Retrieve data by specifying database fields

Use the fields parameter in the GET request and specify a list of fields with a comma
Receive data using the fields parameter
HTTP GET example:
https://onlinedb.net/YOUR_API_KEY/get?fields=temperature,id,is_motion
Result
{ "temperature": 30.98, "id": 9, "is_motion": false }

Retrieve data using the where condition

Please specify the where parameter if you want the database to return records that meet certain conditions. Below is a table with all possible conditions. Please specify count parameter if you expect to return more than one record.
ConditionExampleDescription
eqfield1 eq 2condition of equality
neqstringfield neq catcondition of inequality
>field3 > 5.1greater than
<field4 < 11less than
or(stringfield neq cat) or (id<21)logical OR
and(stringfield eq dog) and (id>777)logical AND
Receive data using the where parameter
HTTP GET example:
https://onlinedb.net/YOUR_KEY/get?fields=temperature,id&where=id>4 and temperature > 20.0&count=3
Result
{ "id": 9, "received": "2020-09-01 12:37:07", "temperature": 30.98, "is_motion": false, "battery_volts": 3.3 }

Delete record

To delete an entry please specify the id parameter
Delete data using the id parameter
HTTP GET example:
https://onlinedb.net/YOUR_KEY/delete?id=5
Result
{ "ok": true }

Data changes, trend

This request responds to data trends for adjacent records
Use the fields parameter in the GET request and specify a list of fields with a comma
See trend using the fields parameter
HTTP GET example:
https://onlinedb.net/YOUR_KEY/trend?fields=battery_volts
Result
{ "battery_volts": -0.5 }

© OnlineDB.net