Ubidots class

Ubidots JavaScript library's main class.

Definition

The Ubidots class is the library's entry point. It provides subclasses to interact with each supported entity in the API. For example, to use the devices APIarrow-up-right, use:

Ubidots.devices.<methods>

The methods exposed by the devices subclass let you use the full devices APIarrow-up-right.

Ubidots class properties

Property
Description

devices

Provides access to devicesarrow-up-right API.

variables

Provides access to variablesarrow-up-right API.

dashboards

Provides access to dashboardsarrow-up-right API.

users

Provides access to usersarrow-up-right API.

organizations

Provides access to organizationsarrow-up-right API.

circle-info

In this section, these properties are referred to as entity or entities. This reflects the part of the API they interact with. For example, device entity refers to the Ubidots class property that interacts with the devicesarrow-up-right API.

Ubidots class methods

Method
Arguments
Description

authenticate

A valid Ubidots token.

Authenticates with the Ubidots API.

setBaseUrl

Custom API Host

Configures a custom base URL for all API requests.

Usage

Authentication

Authentication with a valid Ubidots tokenarrow-up-right is required to use the library:

Custom API Host

Configure a custom base URL when connecting to a dedicated Ubidots deployment:

Instantiation

This class is implemented as a singleton and is instantiated when exported. You do not need to create an instance. Use it directly:

General syntax

The Ubidots class exposes its methods through entities for specific parts of the API, such as devices or variables. Use the following syntax:

Filters syntax

Field filteringarrow-up-right is available for each entity through the following syntax:

Here:

circle-info

Neither where nor addRawParams sends a request to the API. They only build the URL with the corresponding query parameters. To perform the request, chain any of the <getMethod>s after the filter statements.

Last updated

Was this helpful?