Based on API version: v11.0.0
yarn add opensensemap-client
Usage in TypeScript (with ES Modules):
import * as client from 'opensensemap-client';
async function start() {
// Get information about a senseBox
const r = await client.getBox('57000b8745fd40c8196ad04c').catch((e) => console.error(e));
console.log(JSON.stringify(r));
// Post new sensor data
const data: client.PostNewMeasurementsData = [];
const authToken = 'Your senseBox token';
data.push({
sensor: 'Your sensorId',
value: 'Your data'
});
client.postNewMeasurements('Your senseBoxId', data, authToken).catch(console.error);
}
start();
Usage in JavaScript (with CommonJS):
const client = require('opensensemap-client');
async function start() {
// Get information about a senseBox
const r = await client.getBox('57000b8745fd40c8196ad04c').catch((e) => console.error(e));
console.log(JSON.stringify(r));
// Post new sensor data
const data = [];
const authToken = 'Your senseBox token';
data.push({
sensor: 'Your sensorId',
value: 'Your data'
});
client.postNewMeasurements('Your senseBoxId', data, authToken).catch(console.error);
}
start();
- Introduction
- Boxes
- Get one senseBox
- Function:
.getBox()
- Function:
- Get all senseBoxes
- Function:
.getBoxes()
- Function:
- Post new senseBox
- Function:
.postNewBox()
- Function:
- Update a senseBox
- Function:
.updateBox()
- Function:
- Mark a senseBox and its measurements for deletion
- Function:
.deleteBox()
- Function:
- Claim a senseBox marked for transfer
- Function:
.claimBox()
- Function:
- Download the Arduino script for your senseBox
- Function:
.getSketch()
- Function:
- Get locations of a senseBox
- Function:
.getBoxLocations()
- Function:
- Get transfer information for a senseBox
- Function:
.getTransfer()
- Function:
- Mark a senseBox for transferring to a different user
- Function:
.createTransfer()
- Function:
- Revoke transfer token and remove senseBox from transfer
- Function:
.removeTransfer()
- Function:
- Update a transfer token
- Function:
.updateTransfer()
- Function:
- Get one senseBox
- Interpolation
- Measurements
- Post new measurement
- Function:
.postNewMeasurement()
- Function:
- Get the 10000 latest measurements for a sensor
- Function:
.getData()
- Function:
- Delete measurements of a sensor
- Function:
.deleteMeasurements()
- Function:
- Get latest measurements for a grouptag as JSON
- Function:
.getDataByGroupTag()
- Function:
- Get latest measurements for a phenomenon as CSV
- Function:
.getDataMulti()
- Function:
- Get latest measurements of a senseBox
- Function:
.getLatestMeasurements()
- Function:
- Get latest measurements of a sensor
- Function:
.getLatestMeasurementOfSensor()
- Function:
- Post multiple new measurements
- Function:
.postNewMeasurements()
- Function:
- Post new measurement
- Misc
- Get some statistics about the database
- Function:
.getStatistics()
- Function:
- print all routes
- Function:
.printRoutes()
- Function:
- Get some statistics about the database
- Statistics
- Users
- Register new
- Function:
.register()
- Function:
- Delete user, all of its boxes and all of its boxes measurements
- Function:
.deleteUser()
- Function:
- Get details
- Function:
.getUser()
- Function:
- Refresh Authorization
- Function:
.refreshAuth()
- Function:
- Sign in
- Function:
.signIn()
- Function:
- Sign out
- Function:
.signOut()
- Function:
- Update user details
- Function:
.updateUser()
- Function:
- confirm email address
- Function:
.confirmEmail()
- Function:
- list all boxes and sharedBoxes of the signed in user
- Function:
.getUserBoxes()
- Function:
- request a resend of the email confirmation
- Function:
.resendEmailConfirmation()
- Function:
- request password reset
- Function:
.requestPasswordReset()
- Function:
- reset password with passwordResetToken
- Function:
.passwordReset()
- Function:
- Register new
You can find more information in the full documentation.
👤 KillerJulian info@killerjulian.de
- Github: @KillerJulian
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.