1.7.0 ā¢ Published 1 year ago
opensensemap-client v1.7.0
openSenseMap Client
Based on API version: v11.2.0
Install
yarn add opensensemap-client
Usage
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.PostNewMeasurementsParamData = [];
const authToken = 'Your senseBox token';
data.push({
sensor: 'Your sensorId',
value: 'Your data'
});
client.postNewMeasurements('Your senseBoxId', data, authToken).catch(console.error);
}
start();
Listed functions according to API documentation of openSenseMap
- 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
- 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:
- get specific box of the signed in user
- Function:
getUserBox()
- 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 š.
OpenSenseMap API documentation
This library was created with a lot of work, reading the code from the OpenSenseMap-API by hand. In addition, this library provides an Insomnia file for debugging purposes.
Import this file into Insomnia, install the plugins customtimestamp
and save-variables
and configure the environments if you needed. You are ready!
Author
š¤ KillerJulian info@killerjulian.de
- Github: @KillerJulian
š¤ Contributing
Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.