How can we help?
Print

Categories:

OpenAPI

Introduction

Getting Started

UPDATED

The Pelican OpenAPI provides a powerful and flexible way to integrate Pelican devices into your own applications. With real-time access to device data and settings, you can extend the functionality of your Pelican Solution beyond the built-in interface, enabling advanced automation, monitoring, and system control.

What is the Pelican OpenAPI?

The Pelican OpenAPI is a RESTful API that allows you to:

  • Retrieve real-time and historical data from your Pelican devices.
  • Adjust device settings and operational parameters remotely.
  • Integrate Pelican functionality into custom applications, dashboards, or third-party systems.

 

The API supports JSON and XML responses and uses standard HTTP GET and POST methods for requests. All API transactions are encrypted using SSL and require authentication for security.

Who is this for?

The Pelican OpenAPI is designed for developers who want to build custom integrations or automation solutions using their Pelican system. Whether you’re creating a simple script to pull temperature data or a full-scale application to manage multiple devices, the API provides the flexibility and security needed for seamless integration.

API Categories & Key Attributes

The Pelican OpenAPI gives you access to a wide range of data, organized into eight key categories:

Thermostat API – Control and monitor thermostat configurations, settings, and history (up to 2 years). Supports TC and TS series thermostats.

Key Objects:
Thermostat, ThermostatSchedule, SharedSchedule, Thermostat History, ThermostatEvent, ThermostatUsage

Power Control Module API – Control relay states and schedules for PM5-120/240 and PM5-277 modules.

Key Objects: PowerOutput & PowerSchedule

MySites – Retrieve information on all sites linked to a user account.

Key Objects: MySites

Users – Access and modify user profiles and notification settings.

Key Objects: User

Notification – View and manage real-time and historical alerts.

Key Objects: Notification

Sites – Retrieve site-level details from the Pelican App.

Key Objects: Site

Demand Response – Schedule and track demand response events.

Key Objects: drEvent & DemandResponseHistory

Power Usage – Access energy consumption data from Pelican PowerLink (utility unique item, Contact Pelican Sales for more information).

Key Objects: PowerUsage

Attribute Types

System-reserved attributes for standard data points.

Reserved Attributes

User Defined Attributes

Custom attributes that users can create and retrieve.

To define a new attribute, simply set its value via a SET request, then retrieve it with a GET request. User-defined attributes can also be used for filtering data.

Example Use Case: Grouping Thermostats

Want to track specific thermostats? Assign them a custom “managed: yes” attribute and filter your API calls accordingly.

Avialable PERL Software

Pelican Wireless Systems offers a Perl module designed to simplify interactions with the Pelican OpenAPI. This module serves as a convenient wrapper, providing Perl developers with an easier interface to the API. Additionally, it can be used as a reference for constructing valid requests and processing API responses.​

To obtain a copy of the Perl module, please contact Pelican Technical Support.​

Example Script Using the Pelican ClimateControl Perl Module:

GET

How to request an API authentication token from MySites using the Sites object to GET Name, Domaine, and Token attributes.

				
					// request token from mysites.
 #!/usr/bin/perl -w

use ClimateControl;

my $username = 'email@domain.com';
my $password = 'my-password';
my $website = 'mysites.officeclimatecontrol.net';

my $cc = new ClimateControl($username, $password, $website);

my $objectType = 'Sites';
my $selectionAttributes = {
	'name' => 'my-site-name'
};
my $requestedAttributes = [
	'name',
	'domain',
	'token',
];
	
my $data = $cc->getAttributes($objectType, $selectionAttributes, $requestedAttributes);
if(!$data->{success})
{
	print "Failed to get the list of sites - $data->{message}";
	exit 1;
}
my $list = $data->{Sites};
foreach my $site (@$list)
{
	print "The token for site $site->{name} is $site->{token}\n";
				
			

Authentication

To securely access the Pelican OpenAPI, authentication is required for each request. There are two primary methods to authenticate:

1. Username and Password Authentication

Each API request must include the following parameters:

username – This is the email address of a validated Pelican App user. An administrator must add this email address within the Pelican App’s User Management section.

password – The corresponding password for the email address linked to the username. Since the Pelican API only allows SSL connections, the password is automatically encrypted for each request.

2. Token-Based Authentication via MySites

For users managing multiple Pelican sites through MySites, token-based authentication offers a streamlined approach:

Generate a Token: Authenticate with MySites using your username and password to the MySites API, requesting a token. This token can then be used to authenticate with all Pelican Apps associated with your MySites account. Tokens are valid for 24 hours.

Example MySites Token Request:

GET

How to request an API authentication token from MySites using the Sites object to GET Name, Domaine, and Token attributes.

				
					https://mysites.officeclimatecontrol.net/api.cgi?username=Email@domain.com&password=MyPassword&request=get&object=Sites&selection=name:my-site-name&value=name;domain;token
				
			

Example Token Response:

				
					<?xml version="1.0" encoding="UTF-8"?>
<result>
 <Sites>
   <name>my-site-name</name>
   <domain>my-site-name.officeclimatecontrol.net</domain>
   <token>KcRVrDu7Hd6p8YfoXqSq6oln6+nC6eSmY2q12dODy0HEQO5QHkM3dkb/N4OJpshW46JhBj+cwHeRbSgUifI1fwlEQuV0TGLKxiBCq/K3ia2Z8YTQ</token>
 </Sites>
 <success>1</success>
 <message>Retrieved attributes for 1 sites.</message>
</result>
				
			

By implementing these authentication methods, you ensure secure and authorized interactions with the Pelican OpenAPI.​

Best Practices

To optimize your experience with the Pelican OpenAPI, consider implementing the following best practices:

To obtain a copy of the Perl module, please contact Pelican Technical Support.​

Date Formats – Utilize the ISO 8601 Timestamp format (yyyy-mm-ddTHH:MM:SSZ) for setting and retrieving date values. For example: {“startDateTime”: “2022-07-03T00:00:00Z”}.

Create a Dedicated Developer User

For integration purposes, it’s advisable to create a separate, non-personal user account. This approach ensures clarity within the User Management section of the Pelican App regarding which credentials are designated for integration tasks.

Data Retrieval Strategies
  • Historical Data Requests: If real-time data isn’t necessary, opt to request historical data over extended time ranges instead of continuous data pulls. This method reduces server load and enhances efficiency.​

  • Batch Queries for Thermostats: To retrieve data for all thermostats at a site, omit the selection criteria in your request. This technique allows you to gather data for the entire site in a single request, eliminating the need for multiple individual queries.

By adhering to these best practices, you can ensure efficient and effective interactions with the Pelican OpenAPI.

Rate Limites

API requests have no rate limits.

 

Table of Contents