Support
Blues.io
Notehub.io
Shop
Support
Blues.io
Notehub.io
Shop
×
HomeReference
Glossary
Notecard Walkthrough
Overview
Notecard Requests & Responses
JSON Fundamentals
Notecard Interfaces
Essential Requests
Time & Location Requests
Inbound Requests & Shared Data
Web Transactions
Low Power Design
Low Bandwidth Design
Host Firmware Update Requests
Advanced Notecard Configuration
Complete API Reference
Introduction
card Requests
dfu Requests
env Requestsenv.defaultenv.getenv.modifiedenv.set
file Requests
hub Requests
note Requests
web Requests

env Requests

Environment variables are key-value pairs that can be set on the Notecard, or on a device, project and fleet in Notehub.

note

The Hierarchy of Environment Variables

Environment variables can be defined in a number of locations, from the Notecard, to Notehub device settings, the device's Fleet, and the Notehub project. Variables set at different levels of this hierarchy can override one another. When obtaining an environment variable, the Notecard uses the following priority order, where the fist matched result is returned:

  1. The local value.
  2. The value set in Notehub directly on Notehub's record for the Device.
  3. The value set in Notehub on a Fleet to which the Device belongs.
  4. The value set in Notehub on the Project to which the Device belongs.
  5. The default value defined with the env.default request.

env.default

Used by the Notecard host to specify a default value for an environment variable until that variable is overridden by a device, project or fleet-wide setting at Notehub.

Arguments

name

string

The name of the environment variable (case-insensitive).

text

string (optional)

The value of the variable. Pass "" or omit from the request to delete it.

    Response Members
    None: an empty object {} means success.

    env.get

    Returns a single environment variable, or all variables according to precedence rules.

    Arguments

    name

    string (optional)

    The name of the environment variable (case-insensitive). Omit to return all environment variables known to the Notecard.

      Response Members

      text

      string

      If a name was specified, the value of the environment variable.

      body

      JSON object

      If a name was not specified, an object with name and value pairs for all environment variables.

      Example Response
      {
        "body": {
          "monitor-pump": "true",
          "_tags": "office"
        }
      }
      

      env.modified

      Get the time of the update to any environment variable managed by the Notecard.

      Arguments
      None
        Response Members

        time

        UNIX Epoch time

        Timestamp indicating the last time any environment variable was changed on the device.

        Example Response
        {
          "time": 1605814493
        }
        
        More information:
        • Checking for Environment Variable Changes

        env.set

        Sets a local environment variable on the Notecard. Local environment variables cannot be overridden by a Notehub variable of any scope.

        Arguments

        name

        string

        The name of the environment variable (case-insensitive).

        text

        string (optional)

        The value of the variable. Pass "" or omit from the request to delete it.

          Response Members
          None: an empty object {} means success.
          More information:
          • Working with Environment Variables
          dfu Requestsfile Requests
          Can we improve this page? Send us feedbackRate this page
          • ★
            ★
          • ★
            ★
          • ★
            ★
          • ★
            ★
          • ★
            ★
          © 2021 Blues Inc.Terms & ConditionsPrivacy
          blues.ioTwitterLinkedInGitHubHackster.io
          Disconnected
          Disconnected
          Having trouble connecting?

          Try changing your Micro USB cable as some cables do not support transferring data. If that does not solve your problem, contact us at support@blues.com and we will get you set up with another tool to communicate with the Notecard.

          Connect a NotecardClick 'Connect' and select a USB-connected Notecard to start issuing requests from the browser.