@datafire/adafruit

5.0.0 • Public • Published

@datafire/adafruit

Client library for Adafruit IO REST API

Installation and Usage

npm install --save @datafire/adafruit
let adafruit = require('@datafire/adafruit').create({
  HeaderKey: "",
  HeaderSignature: "",
  QueryKey: ""
});

.then(data => {
  console.log(data);
});

Description

The Internet of Things for Everyone

The Adafruit IO HTTP API provides access to your Adafruit IO data from any programming language or hardware environment that can speak HTTP. The easiest way to get started is with an Adafruit IO learn guide and a simple Internet of Things capable device like the Feather Huzzah.

This API documentation is hosted on GitHub Pages and is available at https://github.com/adafruit/io-api. For questions or comments visit the Adafruit IO Forums or the adafruit-io channel on the Adafruit Discord server.

Authentication

Authentication for every API request happens through the X-AIO-Key header or query parameter and your IO API key. A simple cURL request to get all available feeds for a user with the username "io_username" and the key "io_key_12345" could look like this:

$ curl -H "X-AIO-Key: io_key_12345" https://io.adafruit.com/api/v2/io_username/feeds

Or like this:

$ curl "https://io.adafruit.com/api/v2/io_username/feeds?X-AIO-Key=io_key_12345

Using the node.js request library, IO HTTP requests are as easy as:

var request = require('request');

var options = {
  url: 'https://io.adafruit.com/api/v2/io_username/feeds',
  headers: {
    'X-AIO-Key': 'io_key_12345',
    'Content-Type': 'application/json'
  }
};

function callback(error, response, body) {
  if (!error && response.statusCode == 200) {
    var feeds = JSON.parse(body);
    console.log(feeds.length + " FEEDS AVAILABLE");

    feeds.forEach(function (feed) {
      console.log(feed.name, feed.key);
    })
  }
}

request(options, callback);

Using the ESP8266 Arduino HTTPClient library, an HTTPS GET request would look like this (replacing --- with your own values in the appropriate locations):

/// based on
/// https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/examples/Authorization/Authorization.ino

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266HTTPClient.h>

ESP8266WiFiMulti WiFiMulti;

const char* ssid = "---";
const char* password = "---";

const char* host = "io.adafruit.com";

const char* io_key = "---";
const char* path_with_username = "/api/v2/---/dashboards";

// Use web browser to view and copy
// SHA1 fingerprint of the certificate
const char* fingerprint = "77 00 54 2D DA E7 D8 03 27 31 23 99 EB 27 DB CB A5 4C 57 18";

void setup() {
  Serial.begin(115200);

  for(uint8_t t = 4; t > 0; t--) {
    Serial.printf("[SETUP] WAIT %d...\n", t);
    Serial.flush();
    delay(1000);
  }

  WiFi.mode(WIFI_STA);
  WiFiMulti.addAP(ssid, password);

  // wait for WiFi connection
  while(WiFiMulti.run() != WL_CONNECTED) {
    Serial.print('.');
    delay(1000);
  }

  Serial.println("[WIFI] connected!");

  HTTPClient http;

  // start request with URL and TLS cert fingerprint for verification
  http.begin("https://" + String(host) + String(path_with_username), fingerprint);

  // IO API authentication
  http.addHeader("X-AIO-Key", io_key);

  // start connection and send HTTP header
  int httpCode = http.GET();

  // httpCode will be negative on error
  if(httpCode > 0) {
    // HTTP header has been send and Server response header has been handled
    Serial.printf("[HTTP] GET response: %d\n", httpCode);

    // HTTP 200 OK
    if(httpCode == HTTP_CODE_OK) {
      String payload = http.getString();
      Serial.println(payload);
    }

    http.end();
  }
}

void loop() {}

Client Libraries

We have client libraries to help you get started with your project: Python, Ruby, Arduino C++, Javascript, and Go are available. They're all open source, so if they don't already do what you want, you can fork and add any feature you'd like.

Actions

currentUser

Get information about the current user

adafruit.currentUser(null, context)

Input

This action has no parameters

Output

createWebhookFeedData

Send data to a feed via webhook URL.

adafruit.createWebhookFeedData({
  "payload": {}
}, context)

Input

  • input object
    • payload required object
      • value string

Output

createRawWebhookFeedData

The raw data webhook receiver accepts POST requests and stores the raw request body on your feed. This is useful when you don't have control of the webhook sender. If feed history is turned on, payloads will be truncated at 1024 bytes. If feed history is turned off, payloads will be truncated at 100KB.

adafruit.createRawWebhookFeedData(null, context)

Input

This action has no parameters

Output

destroyActivities

Delete all your activities.

adafruit.destroyActivities({
  "username": ""
}, context)

Input

  • input object
    • username required string: a valid username string

Output

Output schema unknown

allActivities

The Activities endpoint returns information about the user's activities.

adafruit.allActivities({
  "username": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • start_time string: Start time for filtering, returns records created after given time.
    • end_time string: End time for filtering, returns records created before give time.
    • limit integer: Limit the number of records returned.

Output

getActivity

The Activities endpoint returns information about the user's activities.

adafruit.getActivity({
  "username": "",
  "type": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • type required string
    • start_time string: Start time for filtering, returns records created after given time.
    • end_time string: End time for filtering, returns records created before give time.
    • limit integer: Limit the number of records returned.

Output

allDashboards

The Dashboards endpoint returns information about the user's dashboards.

adafruit.allDashboards({
  "username": ""
}, context)

Input

  • input object
    • username required string: a valid username string

Output

createDashboard

Create a new Dashboard

adafruit.createDashboard({
  "username": "",
  "dashboard": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • dashboard required object
      • description string
      • key string
      • name string

Output

allBlocks

The Blocks endpoint returns information about the user's blocks.

adafruit.allBlocks({
  "username": "",
  "dashboard_id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • dashboard_id required string

Output

  • output array

createBlock

Create a new Block

adafruit.createBlock({
  "username": "",
  "block": {},
  "dashboard_id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • block required object
      • block_feeds array
        • items object
          • feed_id string
          • group_id string
      • column number
      • dashboard_id number
      • description string
      • key string
      • name string
      • properties object
      • row number
      • size_x number
      • size_y number
      • visual_type string
    • dashboard_id required string

Output

destroyBlock

Delete an existing Block

adafruit.destroyBlock({
  "username": "",
  "dashboard_id": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • dashboard_id required string
    • id required string

Output

  • output string

getBlock

Returns Block based on ID

adafruit.getBlock({
  "username": "",
  "dashboard_id": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • dashboard_id required string
    • id required string

Output

updateBlock

Update properties of an existing Block

adafruit.updateBlock({
  "username": "",
  "dashboard_id": "",
  "id": "",
  "block": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • dashboard_id required string
    • id required string
    • block required object
      • block_feeds array
        • items object
          • feed_id string
          • group_id string
      • column number
      • dashboard_id number
      • description string
      • key string
      • name string
      • properties object
      • row number
      • size_x number
      • size_y number
      • visual_type string

Output

replaceBlock

Replace an existing Block

adafruit.replaceBlock({
  "username": "",
  "dashboard_id": "",
  "id": "",
  "block": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • dashboard_id required string
    • id required string
    • block required object
      • block_feeds array
        • items object
          • feed_id string
          • group_id string
      • column number
      • dashboard_id number
      • description string
      • key string
      • name string
      • properties object
      • row number
      • size_x number
      • size_y number
      • visual_type string

Output

destroyDashboard

Delete an existing Dashboard

adafruit.destroyDashboard({
  "username": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string

Output

  • output string

getDashboard

Returns Dashboard based on ID

adafruit.getDashboard({
  "username": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string

Output

updateDashboard

Update properties of an existing Dashboard

adafruit.updateDashboard({
  "username": "",
  "id": "",
  "dashboard": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string
    • dashboard required object
      • description string
      • key string
      • name string

Output

replaceDashboard

Replace an existing Dashboard

adafruit.replaceDashboard({
  "username": "",
  "id": "",
  "dashboard": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string
    • dashboard required object
      • description string
      • key string
      • name string

Output

allFeeds

The Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed.

adafruit.allFeeds({
  "username": ""
}, context)

Input

  • input object
    • username required string: a valid username string

Output

  • output array

createFeed

Create a new Feed

adafruit.createFeed({
  "username": "",
  "feed": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key string
    • feed required object
      • description string
      • key string
      • license string
      • name string

Output

destroyFeed

Delete an existing Feed

adafruit.destroyFeed({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key

Output

Output schema unknown

getFeed

Returns feed based on the feed key

adafruit.getFeed({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key

Output

updateFeed

Update properties of an existing Feed

adafruit.updateFeed({
  "username": "",
  "feed_key": "",
  "feed": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • feed required object
      • description string
      • key string
      • license string
      • name string

Output

replaceFeed

Replace an existing Feed

adafruit.replaceFeed({
  "username": "",
  "feed_key": "",
  "feed": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • feed required object
      • description string
      • key string
      • license string
      • name string

Output

allData

Get all data for the given feed

adafruit.allData({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • start_time string: Start time for filtering, returns records created after given time.
    • end_time string: End time for filtering, returns records created before give time.
    • limit integer: Limit the number of records returned.
    • include string: List of Data record fields to include in response as comma separated list. Acceptable values are: value, lat, lon, ele, id, and created_at.

Output

createData

Create new data records on the given feed.

NOTE: when feed history is on, data value size is limited to 1KB, when feed history is turned off data value size is limited to 100KB.

adafruit.createData({
  "username": "",
  "feed_key": "",
  "datum": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • datum required object
      • created_at string
      • ele string
      • epoch number
      • lat string
      • lon string
      • value string

Output

batchCreateData

Create multiple new Data records

adafruit.batchCreateData({
  "username": "",
  "feed_key": "",
  "data": []
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • data required array
      • items object
        • created_at string
        • ele string
        • epoch number
        • lat string
        • lon string
        • value string

Output

chartData

The Chart API is what we use on io.adafruit.com to populate charts over varying timespans with a consistent number of data points. The maximum number of points returned is 480. This API works by aggregating slices of time into a single value by averaging.

All time-based parameters are optional, if none are given it will default to 1 hour at the finest-grained resolution possible.

adafruit.chartData({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • start_time string: Start time for filtering, returns records created after given time.
    • end_time string: End time for filtering, returns records created before give time.
    • resolution integer: A resolution size in minutes. By giving a resolution value you will get back grouped data points aggregated over resolution-sized intervals. NOTE: time span is preferred over resolution, so if you request a span of time that includes more than max limit points you may get a larger resolution than you requested. Valid resolutions are 1, 5, 10, 30, 60, and 120.
    • hours integer: The number of hours the chart should cover.

Output

  • output object
    • columns array: The names of the columns returned as data.
      • items string
    • data array: The actual chart data.
      • items array
        • items string
    • feed object
      • id integer
      • key string
      • name string
    • parameters object

firstData

Get the oldest data point in the feed. This request sets the queue pointer to the beginning of the feed.

adafruit.firstData({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • include string: List of Data record fields to include in response as comma separated list. Acceptable values are: value, lat, lon, ele, id, and created_at.

Output

lastData

Get the most recent data point in the feed. This request sets the queue pointer to the end of the feed.

adafruit.lastData({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • include string: List of Data record fields to include in response as comma separated list. Acceptable values are: value, lat, lon, ele, id, and created_at.

Output

nextData

Get the next newest data point in the feed. If queue processing hasn't been started, the first data point in the feed will be returned.

adafruit.nextData({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • include string: List of Data record fields to include in response as comma separated list. Acceptable values are: value, lat, lon, ele, id, and created_at.

Output

previousData

Get the previously processed data point in the feed. NOTE: this method doesn't move the processing queue pointer.

adafruit.previousData({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • include string: List of Data record fields to include in response as comma separated list. Acceptable values are: value, lat, lon, ele, id, and created_at.

Output

retainData

Get the most recent data point in the feed in an MQTT compatible CSV format: value,lat,lon,ele

adafruit.retainData({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key

Output

  • output string

destroyData

Delete existing Data

adafruit.destroyData({
  "username": "",
  "feed_key": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • id required string

Output

  • output string

getData

Returns data based on feed key

adafruit.getData({
  "username": "",
  "feed_key": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • id required string
    • include string: List of Data record fields to include in response as comma separated list. Acceptable values are: value, lat, lon, ele, id, and created_at.

Output

updateData

Update properties of existing Data

adafruit.updateData({
  "username": "",
  "feed_key": "",
  "id": "",
  "datum": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • id required string
    • datum required object
      • created_at string
      • ele string
      • epoch number
      • lat string
      • lon string
      • value string

Output

replaceData

Replace existing Data

adafruit.replaceData({
  "username": "",
  "feed_key": "",
  "id": "",
  "datum": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key
    • id required string
    • datum required object
      • created_at string
      • ele string
      • epoch number
      • lat string
      • lon string
      • value string

Output

getFeedDetails

Returns more detailed feed record based on the feed key

adafruit.getFeedDetails({
  "username": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • feed_key required string: a valid feed key

Output

allGroups

The Groups endpoint returns information about the user's groups. The response includes the latest value of each feed in the group, and other metadata about the group.

adafruit.allGroups({
  "username": ""
}, context)

Input

  • input object
    • username required string: a valid username string

Output

  • output array

createGroup

Create a new Group

adafruit.createGroup({
  "username": "",
  "group": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • group required object
      • description string
      • key string
      • name string

Output

destroyGroup

Delete an existing Group

adafruit.destroyGroup({
  "username": "",
  "group_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key required string

Output

  • output string

getGroup

Returns Group based on ID

adafruit.getGroup({
  "username": "",
  "group_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key required string

Output

updateGroup

Update properties of an existing Group

adafruit.updateGroup({
  "username": "",
  "group_key": "",
  "group": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key required string
    • group required object
      • description string
      • key string
      • name string

Output

replaceGroup

Replace an existing Group

adafruit.replaceGroup({
  "username": "",
  "group_key": "",
  "group": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key required string
    • group required object
      • description string
      • key string
      • name string

Output

addFeedToGroup

Add an existing Feed to a Group

adafruit.addFeedToGroup({
  "group_key": "",
  "username": ""
}, context)

Input

  • input object
    • group_key required string
    • username required string: a valid username string
    • feed_key string

Output

createGroupData

Create new data for multiple feeds in a group

adafruit.createGroupData({
  "username": "",
  "group_key": "",
  "group_feed_data": {
    "feeds": []
  }
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key required string
    • group_feed_data required object
      • created_at string: Optional created_at timestamp which will be applied to all feed values created.
      • feeds required array: An array of feed data records with key and value properties.
        • items object
          • key required string
          • value required string
      • location object: A location record with lat, lon, and [optional] ele properties.
        • ele number
        • lat required number
        • lon required number

Output

allGroupFeeds

The Group Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed, but only for feeds within the given group.

adafruit.allGroupFeeds({
  "group_key": "",
  "username": ""
}, context)

Input

  • input object
    • group_key required string
    • username required string: a valid username string

Output

  • output array

createGroupFeed

Create a new Feed in a Group

adafruit.createGroupFeed({
  "username": "",
  "group_key": "",
  "feed": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key required string
    • feed required object
      • description string
      • key string
      • license string
      • name string

Output

allGroupFeedData

All data for current feed in a specific group

adafruit.allGroupFeedData({
  "username": "",
  "group_key": "",
  "feed_key": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key required string
    • feed_key required string: a valid feed key
    • start_time string: Start time for filtering data. Returns data created after given time.
    • end_time string: End time for filtering data. Returns data created before give time.
    • limit integer: Limit the number of records returned.

Output

createGroupFeedData

Create new Data in a feed belonging to a particular group

adafruit.createGroupFeedData({
  "username": "",
  "group_key": "",
  "feed_key": "",
  "datum": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key required string
    • feed_key required string: a valid feed key
    • datum required object
      • created_at string
      • ele string
      • epoch number
      • lat string
      • lon string
      • value string

Output

batchCreateGroupFeedData

Create multiple new Data records in a feed belonging to a particular group

adafruit.batchCreateGroupFeedData({
  "username": "",
  "group_key": "",
  "feed_key": "",
  "data": []
}, context)

Input

  • input object
    • username required string: a valid username string
    • group_key required string
    • feed_key required string: a valid feed key
    • data required array
      • items object
        • created_at string
        • ele string
        • epoch number
        • lat string
        • lon string
        • value string

Output

removeFeedFromGroup

Remove a Feed from a Group

adafruit.removeFeedFromGroup({
  "group_key": "",
  "username": ""
}, context)

Input

  • input object
    • group_key required string
    • username required string: a valid username string
    • feed_key string

Output

getCurrentUserThrottle

Get the user's data rate limit and current activity level.

adafruit.getCurrentUserThrottle({
  "username": ""
}, context)

Input

  • input object
    • username required string: a valid username string

Output

  • output object
    • active_data_rate integer: Actions taken inside the time window.
    • data_rate_limit integer: Max possible actions inside the time window (usually 1 minute).

allTokens

The Tokens endpoint returns information about the user's tokens.

adafruit.allTokens({
  "username": ""
}, context)

Input

  • input object
    • username required string: a valid username string

Output

  • output array

createToken

Create a new Token

adafruit.createToken({
  "username": "",
  "token": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • token required object
      • token string

Output

destroyToken

Delete an existing Token

adafruit.destroyToken({
  "username": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string

Output

  • output string

getToken

Returns Token based on ID

adafruit.getToken({
  "username": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string

Output

updateToken

Update properties of an existing Token

adafruit.updateToken({
  "username": "",
  "id": "",
  "token": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string
    • token required object
      • token string

Output

replaceToken

Replace an existing Token

adafruit.replaceToken({
  "username": "",
  "id": "",
  "token": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string
    • token required object
      • token string

Output

allTriggers

The Triggers endpoint returns information about the user's triggers.

adafruit.allTriggers({
  "username": ""
}, context)

Input

  • input object
    • username required string: a valid username string

Output

createTrigger

Create a new Trigger

adafruit.createTrigger({
  "username": "",
  "trigger": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • trigger required object
      • name string

Output

destroyTrigger

Delete an existing Trigger

adafruit.destroyTrigger({
  "username": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string

Output

  • output string

getTrigger

Returns Trigger based on ID

adafruit.getTrigger({
  "username": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string

Output

updateTrigger

Update properties of an existing Trigger

adafruit.updateTrigger({
  "username": "",
  "id": "",
  "trigger": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string
    • trigger required object
      • name string

Output

replaceTrigger

Replace an existing Trigger

adafruit.replaceTrigger({
  "username": "",
  "id": "",
  "trigger": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • id required string
    • trigger required object
      • name string

Output

allPermissions

The Permissions endpoint returns information about the user's permissions.

adafruit.allPermissions({
  "username": "",
  "type": "",
  "type_id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • type required string
    • type_id required string

Output

createPermission

Create a new Permission

adafruit.createPermission({
  "username": "",
  "type": "",
  "type_id": "",
  "permission": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • type required string
    • type_id required string
    • permission required object
      • mode string (values: r, w, rw)
      • scope string (values: secret, public, user, organization)
      • scope_value string

Output

destroyPermission

Delete an existing Permission

adafruit.destroyPermission({
  "username": "",
  "type": "",
  "type_id": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • type required string
    • type_id required string
    • id required string

Output

  • output string

getPermission

Returns Permission based on ID

adafruit.getPermission({
  "username": "",
  "type": "",
  "type_id": "",
  "id": ""
}, context)

Input

  • input object
    • username required string: a valid username string
    • type required string
    • type_id required string
    • id required string

Output

updatePermission

Update properties of an existing Permission

adafruit.updatePermission({
  "username": "",
  "type": "",
  "type_id": "",
  "id": "",
  "permission": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • type required string
    • type_id required string
    • id required string
    • permission required object
      • mode string (values: r, w, rw)
      • scope string (values: secret, public, user, organization)
      • scope_value string

Output

replacePermission

Replace an existing Permission

adafruit.replacePermission({
  "username": "",
  "type": "",
  "type_id": "",
  "id": "",
  "permission": {}
}, context)

Input

  • input object
    • username required string: a valid username string
    • type required string
    • type_id required string
    • id required string
    • permission required object
      • mode string (values: r, w, rw)
      • scope string (values: secret, public, user, organization)
      • scope_value string

Output

Definitions

Activity

  • Activity object
    • action string
    • created_at string
    • data object
    • id number
    • model string
    • updated_at string
    • user_id number

Block

  • Block object
    • block_feeds array
    • column number
    • description string
    • key string
    • name string
    • row number
    • size_x number
    • size_y number
    • visual_type string

BlockFeed

  • BlockFeed object

Dashboard

  • Dashboard object
    • blocks array
    • description string
    • key string
    • name string

Data

  • Data object
    • completed_at string
    • created_at string
    • created_epoch number
    • ele number
    • expiration string
    • feed_id number
    • group_id number
    • id string
    • lat number
    • lon number
    • updated_at string
    • value string

DataResponse

  • DataResponse object
    • completed_at string
    • created_at string
    • created_epoch number
    • ele number
    • expiration string
    • feed_id number
    • group_id number
    • id string
    • lat number
    • lon number
    • updated_at string
    • value string

Error

  • Error object
    • code string
    • message string

Feed

  • Feed object
    • created_at string
    • description string
    • details object: Additional details about this feed.
      • data object
        • count integer: Number of data points stored by this feed.
        • first object
        • last object
      • shared_with array: Access control list for this feed
        • items object
    • enabled boolean
    • group object
    • groups array
    • history boolean
    • id number
    • key string
    • last_value string
    • license string
    • name string
    • status string
    • status_notify boolean: Is status notification active?
    • status_timeout integer: Status notification timeout in minutes.
    • unit_symbol string
    • unit_type string
    • updated_at string
    • visibility string (values: private, public)

Group

  • Group object
    • created_at string
    • description string
    • feeds array
    • id number
    • name string
    • updated_at string

Permission

  • Permission object
    • created_at string
    • id number
    • model string (values: feed, group, dashboard)
    • object_id number
    • scope string (values: secret, public, user, organization)
    • scope_value string
    • updated_at string
    • user_id number

ShallowGroup

  • ShallowGroup object
    • created_at string
    • description string
    • id number
    • name string
    • updated_at string

Token

  • Token object
    • token string

Trigger

  • Trigger object
    • name string

User

  • User object
    • color string
    • created_at string
    • id number
    • name string
    • time_zone string
    • updated_at string
    • username string

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
5.0.01latest

Version History

VersionDownloads (Last 7 Days)Published
5.0.01
4.0.01
3.0.00

Package Sidebar

Install

npm i @datafire/adafruit

Weekly Downloads

2

Version

5.0.0

License

MIT

Unpacked Size

151 kB

Total Files

4

Last publish

Collaborators

  • datafire