smart-citizen-node-api

A Node.js wrapper for Smart Citizen Api

Usage no npm install needed!

<script type="module">
  import smartCitizenNodeApi from 'https://cdn.skypack.dev/smart-citizen-node-api';
</script>

README

Smart Citizend API Node

This is a Node.js wrapper/client for the Smart Citizen, integrated with the Smart Citizen New API.

Project owner is AleChelli.

It includes helper functions to do the following:

Devices

  • List all devices (implemented with the new API)

Data

  • Get latest Data
  • Get Sensors Data

Users

  • Get User Info

The methods implemented require an api_key, you can obtain one here:

  • api_key (Register and obtain one)
Dependencies

This project depends on request to make HTTP requests.

Installation

$ npm install smart-citizen-node-api --save

Usage

First, instantiate the wrapper.You need an Api Key obtain here

var smartCitizien = require("smart-citizen-node-api");

// You need an Api Key, you will always use your api_key
var smart = smartCitizien(your_api_key);

Lastly, use the wrapper's helper methods to make the request to Smart Citizen's API.

// List all devices
smart.devices.listAll(function(err, data){
  if(err){
    console.log("Error");
  } else {
    console.log(data);
})

Other API:

  • .data.getSensors(id, from, to, group_by callback);
  • users.listAll(callback)
  • users.me(callback)
  • sensors.listAll()
  • components.listAll()
  • measurements.listAll()
  • kits.listAll()

Development

See something you think can be improved? Open an issue or clone the project and send a pull request with your changes.

Enjoy IoT