test-pack-1 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +872 -0
- data/lib/test_pack_1.rb +63 -0
- data/lib/test_pack_1/api_helper.rb +275 -0
- data/lib/test_pack_1/configuration.rb +63 -0
- data/lib/test_pack_1/controllers/alerts_controller.rb +381 -0
- data/lib/test_pack_1/controllers/assets_controller.rb +227 -0
- data/lib/test_pack_1/controllers/base_controller.rb +51 -0
- data/lib/test_pack_1/controllers/configuration_data_controller.rb +76 -0
- data/lib/test_pack_1/controllers/data_controller.rb +349 -0
- data/lib/test_pack_1/controllers/statuses_controller.rb +215 -0
- data/lib/test_pack_1/exceptions/api_exception.rb +20 -0
- data/lib/test_pack_1/http/auth/custom_query_auth.rb +16 -0
- data/lib/test_pack_1/http/faraday_client.rb +64 -0
- data/lib/test_pack_1/http/http_call_back.rb +24 -0
- data/lib/test_pack_1/http/http_client.rb +104 -0
- data/lib/test_pack_1/http/http_context.rb +20 -0
- data/lib/test_pack_1/http/http_method_enum.rb +13 -0
- data/lib/test_pack_1/http/http_request.rb +50 -0
- data/lib/test_pack_1/http/http_response.rb +23 -0
- data/lib/test_pack_1/models/aggregate_mode_enum.rb +23 -0
- data/lib/test_pack_1/models/alert_item.rb +104 -0
- data/lib/test_pack_1/models/base_model.rb +36 -0
- data/lib/test_pack_1/models/calculation_mode_enum.rb +20 -0
- data/lib/test_pack_1/models/client_configuration.rb +62 -0
- data/lib/test_pack_1/models/configuration_item.rb +55 -0
- data/lib/test_pack_1/models/data_item.rb +92 -0
- data/lib/test_pack_1/models/data_per_category_item.rb +82 -0
- data/lib/test_pack_1/models/data_per_category_response.rb +63 -0
- data/lib/test_pack_1/models/data_real_time_item.rb +83 -0
- data/lib/test_pack_1/models/data_signal.rb +53 -0
- data/lib/test_pack_1/models/data_signal_configuration.rb +66 -0
- data/lib/test_pack_1/models/data_signal_item.rb +62 -0
- data/lib/test_pack_1/models/device.rb +208 -0
- data/lib/test_pack_1/models/device_model.rb +53 -0
- data/lib/test_pack_1/models/metadata_field.rb +44 -0
- data/lib/test_pack_1/models/power_curve.rb +60 -0
- data/lib/test_pack_1/models/power_curve_value.rb +44 -0
- data/lib/test_pack_1/models/resolution_enum.rb +41 -0
- data/lib/test_pack_1/models/site.rb +44 -0
- data/lib/test_pack_1/models/site_with_data.rb +78 -0
- data/lib/test_pack_1/models/status_category_enum.rb +26 -0
- data/lib/test_pack_1/models/status_item.rb +161 -0
- data/lib/test_pack_1/models/time_zone_configuration.rb +76 -0
- data/lib/test_pack_1/models/turbine_type.rb +89 -0
- data/lib/test_pack_1/test_pack1_client.rb +51 -0
- data/test/controllers/controller_test_base.rb +33 -0
- data/test/controllers/test_assets_controller.rb +46 -0
- data/test/controllers/test_configuration_data_controller.rb +44 -0
- data/test/http_response_catcher.rb +20 -0
- data/test/test_helper.rb +99 -0
- metadata +219 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 367ea37c5d4bc623cde9384d55206e870a5a1a0d88515e28586d41647fec2d46
|
4
|
+
data.tar.gz: a36f381b70dff04befa77f9306fbd92674b7decba0c9536648bdcef61404d0e2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6bdada923f3544ba7f5cc4fff61064d4520bba64bc582c7496ed443539aaaf768e49e08e2e85069b423e7ff3b28133a190bde001ddaad0925252e2cf867f18b8
|
7
|
+
data.tar.gz: '096bf1d0054db937f8348ab9d0d87bd19937da6865b3f923bd0f12a7172b1348dbbdd8d6fcb8e8937bf8455e654976ca5cf1c8dcf3109be6b17f6c5688330f0b'
|
data/LICENSE
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
License:
|
2
|
+
========
|
3
|
+
The MIT License (MIT)
|
4
|
+
http://opensource.org/licenses/MIT
|
5
|
+
|
6
|
+
Copyright (c) 2014 - 2016 APIMATIC Limited
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
10
|
+
in the Software without restriction, including without limitation the rights
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
13
|
+
furnished to do so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in
|
16
|
+
all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
THE SOFTWARE.
|
25
|
+
|
26
|
+
Trade Mark:
|
27
|
+
==========
|
28
|
+
APIMATIC is a trade mark for APIMATIC Limited
|
data/README.md
ADDED
@@ -0,0 +1,872 @@
|
|
1
|
+
# Getting started
|
2
|
+
|
3
|
+
This is the public API for the Greenbyte Platform.
|
4
|
+
|
5
|
+
**Note that this is the beta version of the API,** containing new features that might change. This means that any SDKs downloaded for this version might have minor incompatibilities in the future. If you want to view the latest stable API specification, use the version selection dropdown in the top right of the page.
|
6
|
+
|
7
|
+
# What's new
|
8
|
+
## 2020-06-08 – Data endpoint aggregation by group
|
9
|
+
If you have divided you sites into groups of assets, you can now aggregate your data by those groups when calling the Data, Real Time Data, and Data Per Category endpoints.
|
10
|
+
The new `deviceLevel` aggregation mode (`aggregate` parameter) aggregates data based on the hierarchy level directly below site.
|
11
|
+
|
12
|
+
## 2020-04-27 – Data signal permissions
|
13
|
+
It is now possible to set permissions for individual data signals for API keys (**Share** > **API Keys** in the Greenbyte
|
14
|
+
Platform). When adding/editing an API key, there is a new option to select authorized data signals in addition to the
|
15
|
+
device selection. Leaving the signal selection blank (nothing selected) gives permission to all current and future data
|
16
|
+
signals, just like previously created API keys.
|
17
|
+
|
18
|
+
API endpoints affected by data signal permissions:
|
19
|
+
* `datasignals.json`: filters returned data signals based on permissions.
|
20
|
+
* `data.json`, `realtimedata.json`, `datapercategory.json`: gives *401 Unauthorized* error for data signals without permission.
|
21
|
+
* `status.json`, `activestatus.json`: may omit lost production values (in the `lostProduction` field) based on data signal permissions.
|
22
|
+
|
23
|
+
## 2020-03-30 – Data Per Category endpoint
|
24
|
+
We have added a new endpoint to the Greenbyte Platform to make it possible to extract Lost Production data per contract category from the API. You can find more information about this endpoint here: [Data Per Category](#/http/api-endpoints/data/get-data-per-category).
|
25
|
+
|
26
|
+
# General notes regarding endpoints
|
27
|
+
|
28
|
+
* Endpoints that take `page` and `pageSize` parameters return a `Link` header as defined in [RFC 8288](https://tools.ietf.org/html/rfc8288).
|
29
|
+
* Some endpoints return data in your local time zone. This time zone can be fetched from the `configuration.json` endpoint.
|
30
|
+
* All endpoints can also be reached using the POST method, with a JSON request body instead of query parameters.
|
31
|
+
* All endpoints implement rate limiting. More information is available under the *429* error response description for each endpoint.
|
32
|
+
|
33
|
+
|
34
|
+
## How to Build
|
35
|
+
|
36
|
+
This client library is a Ruby gem which can be compiled and used in your Ruby and Ruby on Rails project. This library requires a few gems from the RubyGems repository.
|
37
|
+
|
38
|
+
1. Open the command line interface or the terminal and navigate to the folder containing the source code.
|
39
|
+
2. Run ``` gem build test_pack_1.gemspec ``` to build the gem.
|
40
|
+
3. Once built, the gem can be installed on the current work environment using ``` gem install test_pack_1-1.0.0.gem ```
|
41
|
+
|
42
|
+
![Building Gem](https://apidocs.io/illustration/ruby?step=buildSDK&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=Greenbyte%20API-Ruby&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0)
|
43
|
+
|
44
|
+
## How to Use
|
45
|
+
|
46
|
+
The following section explains how to use the TestPack1 Ruby Gem in a new Rails project using RubyMine™. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
|
47
|
+
|
48
|
+
### 1. Starting a new project
|
49
|
+
|
50
|
+
Close any existing projects in RubyMine™ by selecting ``` File -> Close Project ```. Next, click on ``` Create New Project ``` to create a new project from scratch.
|
51
|
+
|
52
|
+
![Create a new project in RubyMine](https://apidocs.io/illustration/ruby?step=createNewProject0&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=TestPack1&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0)
|
53
|
+
|
54
|
+
Next, provide ``` TestApp ``` as the project name, choose ``` Rails Application ``` as the project type, and click ``` OK ```.
|
55
|
+
|
56
|
+
![Create a new Rails Application in RubyMine - step 1](https://apidocs.io/illustration/ruby?step=createNewProject1&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=TestPack1&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0)
|
57
|
+
|
58
|
+
In the next dialog make sure that correct *Ruby SDK* is being used (minimum 2.0.0) and click ``` OK ```.
|
59
|
+
|
60
|
+
![Create a new Rails Application in RubyMine - step 2](https://apidocs.io/illustration/ruby?step=createNewProject2&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=TestPack1&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0)
|
61
|
+
|
62
|
+
This will create a new Rails Application project with an existing set of files and folder.
|
63
|
+
|
64
|
+
### 2. Add reference of the gem
|
65
|
+
|
66
|
+
In order to use the TestPack1 gem in the new project we must add a gem reference. Locate the ```Gemfile``` in the *Project Explorer* window under the ``` TestApp ``` project node. The file contains references to all gems being used in the project. Here, add the reference to the library gem by adding the following line: ``` gem 'test_pack_1', '~> 1.0.0' ```
|
67
|
+
|
68
|
+
![Add references of the Gemfile](https://apidocs.io/illustration/ruby?step=addReference&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=TestPack1&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0)
|
69
|
+
|
70
|
+
### 3. Adding a new Rails Controller
|
71
|
+
|
72
|
+
Once the ``` TestApp ``` project is created, a folder named ``` controllers ``` will be visible in the *Project Explorer* under the following path: ``` TestApp > app > controllers ```. Right click on this folder and select ``` New -> Run Rails Generator... ```.
|
73
|
+
|
74
|
+
![Run Rails Generator on Controllers Folder](https://apidocs.io/illustration/ruby?step=addCode0&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=TestPack1&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0)
|
75
|
+
|
76
|
+
Selecting the said option will popup a small window where the generator names are displayed. Here, select the ``` controller ``` template.
|
77
|
+
|
78
|
+
![Create a new Controller](https://apidocs.io/illustration/ruby?step=addCode1&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=TestPack1&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0)
|
79
|
+
|
80
|
+
Next, a popup window will ask you for a Controller name and included Actions. For controller name provide ``` Hello ``` and include an action named ``` Index ``` and click ``` OK ```.
|
81
|
+
|
82
|
+
![Add a new Controller](https://apidocs.io/illustration/ruby?step=addCode2&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=TestPack1&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0)
|
83
|
+
|
84
|
+
A new controller class anmed ``` HelloController ``` will be created in a file named ``` hello_controller.rb ``` containing a method named ``` Index ```. In this method, add code for initialization and a sample for its usage.
|
85
|
+
|
86
|
+
![Initialize the library](https://apidocs.io/illustration/ruby?step=addCode3&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=TestPack1&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0)
|
87
|
+
|
88
|
+
## How to Test
|
89
|
+
|
90
|
+
You can test the generated SDK and the server with automatically generated test
|
91
|
+
cases as follows:
|
92
|
+
|
93
|
+
1. From terminal/cmd navigate to the root directory of the SDK.
|
94
|
+
2. Invoke: `bundle exec rake`
|
95
|
+
|
96
|
+
## Initialization
|
97
|
+
|
98
|
+
### Authentication
|
99
|
+
In order to setup authentication and initialization of the API client, you need the following information.
|
100
|
+
|
101
|
+
| Parameter | Description |
|
102
|
+
|-----------|-------------|
|
103
|
+
| api_token | TODO: add a description |
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
API client can be initialized as following.
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
# Configuration parameters and credentials
|
111
|
+
api_token = 'api_token'
|
112
|
+
|
113
|
+
client = TestPack1::TestPack1Client.new(
|
114
|
+
api_token: api_token
|
115
|
+
)
|
116
|
+
```
|
117
|
+
|
118
|
+
The added initlization code can be debugged by putting a breakpoint in the ``` Index ``` method and running the project in debug mode by selecting ``` Run -> Debug 'Development: TestApp' ```.
|
119
|
+
|
120
|
+
![Debug the TestApp](https://apidocs.io/illustration/ruby?step=addCode4&workspaceFolder=Greenbyte%20API-Ruby&workspaceName=TestPack1&projectName=test_pack_1&gemName=test_pack_1&gemVer=1.0.0&initLine=client%2520%253D%2520TestPack1Client.new%2528%2527api_token%2527%2529)
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
# Class Reference
|
125
|
+
|
126
|
+
## <a name="list_of_controllers"></a>List of Controllers
|
127
|
+
|
128
|
+
* [StatusesController](#statuses_controller)
|
129
|
+
* [DataController](#data_controller)
|
130
|
+
* [AlertsController](#alerts_controller)
|
131
|
+
* [ConfigurationDataController](#configuration_data_controller)
|
132
|
+
* [AssetsController](#assets_controller)
|
133
|
+
|
134
|
+
## <a name="statuses_controller"></a>![Class: ](https://apidocs.io/img/class.png ".StatusesController") StatusesController
|
135
|
+
|
136
|
+
### Get singleton instance
|
137
|
+
|
138
|
+
The singleton instance of the ``` StatusesController ``` class can be accessed from the API Client.
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
statuses_controller = client.statuses
|
142
|
+
```
|
143
|
+
|
144
|
+
### <a name="get_active_statuses"></a>![Method: ](https://apidocs.io/img/method.png ".StatusesController.get_active_statuses") get_active_statuses
|
145
|
+
|
146
|
+
> Gets active statuses for multiple devices. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
147
|
+
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
def get_active_statuses(device_ids,
|
151
|
+
category = nil,
|
152
|
+
fields = nil,
|
153
|
+
sort_by = nil,
|
154
|
+
sort_asc = false,
|
155
|
+
page_size = 50,
|
156
|
+
page = 1); end
|
157
|
+
```
|
158
|
+
|
159
|
+
#### Parameters
|
160
|
+
|
161
|
+
| Parameter | Tags | Description |
|
162
|
+
|-----------|------|-------------|
|
163
|
+
| device_ids | ``` Required ``` ``` Collection ``` | Which devices to get statuses for. |
|
164
|
+
| category | ``` Optional ``` ``` Collection ``` | Which status categories to get statuses for. |
|
165
|
+
| fields | ``` Optional ``` ``` Collection ``` | Which fields to include in the response. Valid fields are those defined in the `StatusItem` schema. By default all fields are included. |
|
166
|
+
| sort_by | ``` Optional ``` ``` Collection ``` | Which fields to sort the response items by. By default the items are sorted by timestampStart. |
|
167
|
+
| sort_asc | ``` Optional ``` ``` DefaultValue ``` | Whether to sort the items in ascending order. |
|
168
|
+
| page_size | ``` Optional ``` ``` DefaultValue ``` | The number of items to return per page. |
|
169
|
+
| page | ``` Optional ``` ``` DefaultValue ``` | Which page to return when the number of items exceed the page size. |
|
170
|
+
|
171
|
+
|
172
|
+
#### Example Usage
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
device_ids = [161]
|
176
|
+
category = [TestPack1::StatusCategoryEnum::STOP]
|
177
|
+
fields = ['fields']
|
178
|
+
sort_by = ['sortBy']
|
179
|
+
sort_asc = false
|
180
|
+
page_size = 50
|
181
|
+
page = 1
|
182
|
+
|
183
|
+
result = statuses_controller.get_active_statuses(device_ids, category, fields, sort_by, sort_asc, page_size, page)
|
184
|
+
|
185
|
+
```
|
186
|
+
|
187
|
+
#### Errors
|
188
|
+
|
189
|
+
| Error Code | Error Description |
|
190
|
+
|------------|-------------------|
|
191
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
192
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
193
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
194
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
### <a name="get_statuses"></a>![Method: ](https://apidocs.io/img/method.png ".StatusesController.get_statuses") get_statuses
|
199
|
+
|
200
|
+
> Gets statuses for multiple devices during the given time period. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
201
|
+
|
202
|
+
|
203
|
+
```ruby
|
204
|
+
def get_statuses(device_ids,
|
205
|
+
timestamp_start,
|
206
|
+
timestamp_end,
|
207
|
+
category = nil,
|
208
|
+
fields = nil,
|
209
|
+
sort_by = nil,
|
210
|
+
sort_asc = false,
|
211
|
+
page_size = 50,
|
212
|
+
page = 1); end
|
213
|
+
```
|
214
|
+
|
215
|
+
#### Parameters
|
216
|
+
|
217
|
+
| Parameter | Tags | Description |
|
218
|
+
|-----------|------|-------------|
|
219
|
+
| device_ids | ``` Required ``` ``` Collection ``` | Which devices to get statuses for. |
|
220
|
+
| timestamp_start | ``` Required ``` | The first timestamp to get data for. Timestamps ending with 'Z' are treated as UTC. Other timestamps are treated as local time in your system-configured time zone. |
|
221
|
+
| timestamp_end | ``` Required ``` | The last timestamp to get data for. Timestamps ending with 'Z' are treated as UTC. Other timestamps are treated as local time in your system-configured time zone. |
|
222
|
+
| category | ``` Optional ``` ``` Collection ``` | Which status categories to get statuses for. |
|
223
|
+
| fields | ``` Optional ``` ``` Collection ``` | Which fields to include in the response. Valid fields are those defined in the `StatusItem` schema. By default all fields are included. |
|
224
|
+
| sort_by | ``` Optional ``` ``` Collection ``` | Which fields to sort the response items by. By default the items are sorted by timestampStart. |
|
225
|
+
| sort_asc | ``` Optional ``` ``` DefaultValue ``` | Whether to sort the items in ascending order. |
|
226
|
+
| page_size | ``` Optional ``` ``` DefaultValue ``` | The number of items to return per page. |
|
227
|
+
| page | ``` Optional ``` ``` DefaultValue ``` | Which page to return when the number of items exceed the page size. |
|
228
|
+
|
229
|
+
|
230
|
+
#### Example Usage
|
231
|
+
|
232
|
+
```ruby
|
233
|
+
device_ids = [161]
|
234
|
+
timestamp_start = DateTime.now
|
235
|
+
timestamp_end = DateTime.now
|
236
|
+
category = [TestPack1::StatusCategoryEnum::STOP]
|
237
|
+
fields = ['fields']
|
238
|
+
sort_by = ['sortBy']
|
239
|
+
sort_asc = false
|
240
|
+
page_size = 50
|
241
|
+
page = 1
|
242
|
+
|
243
|
+
result = statuses_controller.get_statuses(device_ids, timestamp_start, timestamp_end, category, fields, sort_by, sort_asc, page_size, page)
|
244
|
+
|
245
|
+
```
|
246
|
+
|
247
|
+
#### Errors
|
248
|
+
|
249
|
+
| Error Code | Error Description |
|
250
|
+
|------------|-------------------|
|
251
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
252
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
253
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
254
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
[Back to List of Controllers](#list_of_controllers)
|
259
|
+
|
260
|
+
## <a name="data_controller"></a>![Class: ](https://apidocs.io/img/class.png ".DataController") DataController
|
261
|
+
|
262
|
+
### Get singleton instance
|
263
|
+
|
264
|
+
The singleton instance of the ``` DataController ``` class can be accessed from the API Client.
|
265
|
+
|
266
|
+
```ruby
|
267
|
+
data_controller = client.data
|
268
|
+
```
|
269
|
+
|
270
|
+
### <a name="get_data_signals"></a>![Method: ](https://apidocs.io/img/method.png ".DataController.get_data_signals") get_data_signals
|
271
|
+
|
272
|
+
> Gets authorized data signals for one or more devices. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
273
|
+
|
274
|
+
|
275
|
+
```ruby
|
276
|
+
def get_data_signals(device_ids); end
|
277
|
+
```
|
278
|
+
|
279
|
+
#### Parameters
|
280
|
+
|
281
|
+
| Parameter | Tags | Description |
|
282
|
+
|-----------|------|-------------|
|
283
|
+
| device_ids | ``` Required ``` ``` Collection ``` | What devices to get data signals for. |
|
284
|
+
|
285
|
+
|
286
|
+
#### Example Usage
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
device_ids = [161]
|
290
|
+
|
291
|
+
result = data_controller.get_data_signals(device_ids)
|
292
|
+
|
293
|
+
```
|
294
|
+
|
295
|
+
#### Errors
|
296
|
+
|
297
|
+
| Error Code | Error Description |
|
298
|
+
|------------|-------------------|
|
299
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
300
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
301
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
302
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
### <a name="get_data"></a>![Method: ](https://apidocs.io/img/method.png ".DataController.get_data") get_data
|
307
|
+
|
308
|
+
> Gets data for multiple devices and data signals in the given resolution. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
309
|
+
|
310
|
+
|
311
|
+
```ruby
|
312
|
+
def get_data(device_ids,
|
313
|
+
data_signal_ids,
|
314
|
+
timestamp_start,
|
315
|
+
timestamp_end,
|
316
|
+
resolution = nil,
|
317
|
+
aggregate = nil,
|
318
|
+
calculation = nil); end
|
319
|
+
```
|
320
|
+
|
321
|
+
#### Parameters
|
322
|
+
|
323
|
+
| Parameter | Tags | Description |
|
324
|
+
|-----------|------|-------------|
|
325
|
+
| device_ids | ``` Required ``` ``` Collection ``` | Which devices to get data for. |
|
326
|
+
| data_signal_ids | ``` Required ``` ``` Collection ``` | Which data signals to get data for. |
|
327
|
+
| timestamp_start | ``` Required ``` | The first timestamp to get data for. Timestamps ending with 'Z' are treated as UTC. Other timestamps are treated as local time in your system-configured time zone. |
|
328
|
+
| timestamp_end | ``` Required ``` | The last timestamp to get data for. Timestamps ending with 'Z' are treated as UTC. Other timestamps are treated as local time in your system-configured time zone. |
|
329
|
+
| resolution | ``` Optional ``` | The desired data resolution. |
|
330
|
+
| aggregate | ``` Optional ``` | How the data should be aggregated with regards to device(s) or site(s). |
|
331
|
+
| calculation | ``` Optional ``` | The calculation used when aggregating data, both over time and across devices. The default is the data signal default. |
|
332
|
+
|
333
|
+
|
334
|
+
#### Example Usage
|
335
|
+
|
336
|
+
```ruby
|
337
|
+
device_ids = [161]
|
338
|
+
data_signal_ids = [161]
|
339
|
+
timestamp_start = DateTime.now
|
340
|
+
timestamp_end = DateTime.now
|
341
|
+
resolution = TestPack1::ResolutionEnum::ENUM_5MINUTE
|
342
|
+
aggregate = TestPack1::AggregateModeEnum::DEVICE
|
343
|
+
calculation = TestPack1::CalculationModeEnum::AVERAGE
|
344
|
+
|
345
|
+
result = data_controller.get_data(device_ids, data_signal_ids, timestamp_start, timestamp_end, resolution, aggregate, calculation)
|
346
|
+
|
347
|
+
```
|
348
|
+
|
349
|
+
#### Errors
|
350
|
+
|
351
|
+
| Error Code | Error Description |
|
352
|
+
|------------|-------------------|
|
353
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
354
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
355
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
356
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
### <a name="get_real_time_data"></a>![Method: ](https://apidocs.io/img/method.png ".DataController.get_real_time_data") get_real_time_data
|
361
|
+
|
362
|
+
> Gets the most recent high-resolution data point for each specified device and data signal. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
363
|
+
|
364
|
+
|
365
|
+
```ruby
|
366
|
+
def get_real_time_data(device_ids,
|
367
|
+
data_signal_ids,
|
368
|
+
aggregate = nil,
|
369
|
+
calculation = nil); end
|
370
|
+
```
|
371
|
+
|
372
|
+
#### Parameters
|
373
|
+
|
374
|
+
| Parameter | Tags | Description |
|
375
|
+
|-----------|------|-------------|
|
376
|
+
| device_ids | ``` Required ``` ``` Collection ``` | Which devices to get data for. |
|
377
|
+
| data_signal_ids | ``` Required ``` ``` Collection ``` | Which data signals to get data for. |
|
378
|
+
| aggregate | ``` Optional ``` | How the data should be aggregated with regards to device(s) or site(s). |
|
379
|
+
| calculation | ``` Optional ``` | The calculation used when aggregating data, both over time and across devices. The default is the data signal default. |
|
380
|
+
|
381
|
+
|
382
|
+
#### Example Usage
|
383
|
+
|
384
|
+
```ruby
|
385
|
+
device_ids = [161]
|
386
|
+
data_signal_ids = [161]
|
387
|
+
aggregate = TestPack1::AggregateModeEnum::DEVICE
|
388
|
+
calculation = TestPack1::CalculationModeEnum::AVERAGE
|
389
|
+
|
390
|
+
result = data_controller.get_real_time_data(device_ids, data_signal_ids, aggregate, calculation)
|
391
|
+
|
392
|
+
```
|
393
|
+
|
394
|
+
#### Errors
|
395
|
+
|
396
|
+
| Error Code | Error Description |
|
397
|
+
|------------|-------------------|
|
398
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
399
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
400
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
401
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
### <a name="get_data_per_category"></a>![Method: ](https://apidocs.io/img/method.png ".DataController.get_data_per_category") get_data_per_category
|
406
|
+
|
407
|
+
> Gets signal data aggregated per availability contract category. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
408
|
+
|
409
|
+
|
410
|
+
```ruby
|
411
|
+
def get_data_per_category(device_ids,
|
412
|
+
data_signal_id,
|
413
|
+
timestamp_start,
|
414
|
+
timestamp_end,
|
415
|
+
aggregate = nil,
|
416
|
+
category = nil); end
|
417
|
+
```
|
418
|
+
|
419
|
+
#### Parameters
|
420
|
+
|
421
|
+
| Parameter | Tags | Description |
|
422
|
+
|-----------|------|-------------|
|
423
|
+
| device_ids | ``` Required ``` ``` Collection ``` | Which devices to get data for. |
|
424
|
+
| data_signal_id | ``` Required ``` | Which signal to get data for; only Lost Production signals are supported at the moment. |
|
425
|
+
| timestamp_start | ``` Required ``` | The first timestamp to get data for. Timestamps ending with 'Z' are treated as UTC. Other timestamps are treated as local time in your system-configured time zone. |
|
426
|
+
| timestamp_end | ``` Required ``` | The last timestamp to get data for. Timestamps ending with 'Z' are treated as UTC. Other timestamps are treated as local time in your system-configured time zone. |
|
427
|
+
| aggregate | ``` Optional ``` | How the data should be aggregated with regards to device(s) or site(s). |
|
428
|
+
| category | ``` Optional ``` ``` Collection ``` | Which status categories to include. By default all categories are included. |
|
429
|
+
|
430
|
+
|
431
|
+
#### Example Usage
|
432
|
+
|
433
|
+
```ruby
|
434
|
+
device_ids = [161]
|
435
|
+
data_signal_id = 161
|
436
|
+
timestamp_start = DateTime.now
|
437
|
+
timestamp_end = DateTime.now
|
438
|
+
aggregate = TestPack1::AggregateModeEnum::DEVICE
|
439
|
+
category = [TestPack1::StatusCategoryEnum::STOP]
|
440
|
+
|
441
|
+
result = data_controller.get_data_per_category(device_ids, data_signal_id, timestamp_start, timestamp_end, aggregate, category)
|
442
|
+
|
443
|
+
```
|
444
|
+
|
445
|
+
#### Errors
|
446
|
+
|
447
|
+
| Error Code | Error Description |
|
448
|
+
|------------|-------------------|
|
449
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
450
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
451
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
452
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
[Back to List of Controllers](#list_of_controllers)
|
457
|
+
|
458
|
+
## <a name="alerts_controller"></a>![Class: ](https://apidocs.io/img/class.png ".AlertsController") AlertsController
|
459
|
+
|
460
|
+
### Get singleton instance
|
461
|
+
|
462
|
+
The singleton instance of the ``` AlertsController ``` class can be accessed from the API Client.
|
463
|
+
|
464
|
+
```ruby
|
465
|
+
alerts_controller = client.alerts
|
466
|
+
```
|
467
|
+
|
468
|
+
### <a name="get_active_alarms"></a>![Method: ](https://apidocs.io/img/method.png ".AlertsController.get_active_alarms") get_active_alarms
|
469
|
+
|
470
|
+
> _This endpoint is deprecated. Please use the new endpoint `/activealerts.json` instead._
|
471
|
+
|
472
|
+
|
473
|
+
```ruby
|
474
|
+
def get_active_alarms(device_ids,
|
475
|
+
fields = nil,
|
476
|
+
sort_by = nil,
|
477
|
+
sort_asc = false,
|
478
|
+
page_size = 50,
|
479
|
+
page = 1); end
|
480
|
+
```
|
481
|
+
|
482
|
+
#### Parameters
|
483
|
+
|
484
|
+
| Parameter | Tags | Description |
|
485
|
+
|-----------|------|-------------|
|
486
|
+
| device_ids | ``` Required ``` ``` Collection ``` | What devices to get alerts for. |
|
487
|
+
| fields | ``` Optional ``` ``` Collection ``` | Which fields to include in the response. Valid fields are those defined in the `AlertItem` schema. By default all fields are included. |
|
488
|
+
| sort_by | ``` Optional ``` ``` Collection ``` | Which fields to sort the response items by. By default the items are sorted by timestampStart. |
|
489
|
+
| sort_asc | ``` Optional ``` ``` DefaultValue ``` | Whether to sort the items in ascending order. |
|
490
|
+
| page_size | ``` Optional ``` ``` DefaultValue ``` | The number of items to return per page. |
|
491
|
+
| page | ``` Optional ``` ``` DefaultValue ``` | Which page to return when the number of items exceed the page size. |
|
492
|
+
|
493
|
+
|
494
|
+
#### Example Usage
|
495
|
+
|
496
|
+
```ruby
|
497
|
+
device_ids = [161]
|
498
|
+
fields = ['fields']
|
499
|
+
sort_by = ['sortBy']
|
500
|
+
sort_asc = false
|
501
|
+
page_size = 50
|
502
|
+
page = 1
|
503
|
+
|
504
|
+
result = alerts_controller.get_active_alarms(device_ids, fields, sort_by, sort_asc, page_size, page)
|
505
|
+
|
506
|
+
```
|
507
|
+
|
508
|
+
#### Errors
|
509
|
+
|
510
|
+
| Error Code | Error Description |
|
511
|
+
|------------|-------------------|
|
512
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
513
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
514
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
515
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
### <a name="get_active_alerts"></a>![Method: ](https://apidocs.io/img/method.png ".AlertsController.get_active_alerts") get_active_alerts
|
520
|
+
|
521
|
+
> Gets active alerts for multiple devices.
|
522
|
+
|
523
|
+
|
524
|
+
```ruby
|
525
|
+
def get_active_alerts(device_ids,
|
526
|
+
fields = nil,
|
527
|
+
sort_by = nil,
|
528
|
+
sort_asc = false,
|
529
|
+
page_size = 50,
|
530
|
+
page = 1); end
|
531
|
+
```
|
532
|
+
|
533
|
+
#### Parameters
|
534
|
+
|
535
|
+
| Parameter | Tags | Description |
|
536
|
+
|-----------|------|-------------|
|
537
|
+
| device_ids | ``` Required ``` ``` Collection ``` | What devices to get alerts for. |
|
538
|
+
| fields | ``` Optional ``` ``` Collection ``` | Which fields to include in the response. Valid fields are those defined in the `AlertItem` schema. By default all fields are included. |
|
539
|
+
| sort_by | ``` Optional ``` ``` Collection ``` | Which fields to sort the response items by. By default the items are sorted by timestampStart. |
|
540
|
+
| sort_asc | ``` Optional ``` ``` DefaultValue ``` | Whether to sort the items in ascending order. |
|
541
|
+
| page_size | ``` Optional ``` ``` DefaultValue ``` | The number of items to return per page. |
|
542
|
+
| page | ``` Optional ``` ``` DefaultValue ``` | Which page to return when the number of items exceed the page size. |
|
543
|
+
|
544
|
+
|
545
|
+
#### Example Usage
|
546
|
+
|
547
|
+
```ruby
|
548
|
+
device_ids = [161]
|
549
|
+
fields = ['fields']
|
550
|
+
sort_by = ['sortBy']
|
551
|
+
sort_asc = false
|
552
|
+
page_size = 50
|
553
|
+
page = 1
|
554
|
+
|
555
|
+
result = alerts_controller.get_active_alerts(device_ids, fields, sort_by, sort_asc, page_size, page)
|
556
|
+
|
557
|
+
```
|
558
|
+
|
559
|
+
#### Errors
|
560
|
+
|
561
|
+
| Error Code | Error Description |
|
562
|
+
|------------|-------------------|
|
563
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
564
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
565
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
566
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
### <a name="get_alerts"></a>![Method: ](https://apidocs.io/img/method.png ".AlertsController.get_alerts") get_alerts
|
571
|
+
|
572
|
+
> Gets alerts for multiple devices and the given time period.
|
573
|
+
|
574
|
+
|
575
|
+
```ruby
|
576
|
+
def get_alerts(device_ids,
|
577
|
+
timestamp_start,
|
578
|
+
timestamp_end,
|
579
|
+
fields = nil,
|
580
|
+
sort_by = nil,
|
581
|
+
sort_asc = false,
|
582
|
+
page_size = 50,
|
583
|
+
page = 1); end
|
584
|
+
```
|
585
|
+
|
586
|
+
#### Parameters
|
587
|
+
|
588
|
+
| Parameter | Tags | Description |
|
589
|
+
|-----------|------|-------------|
|
590
|
+
| device_ids | ``` Required ``` ``` Collection ``` | What devices to get alerts for. |
|
591
|
+
| timestamp_start | ``` Required ``` | The first timestamp to get data for. |
|
592
|
+
| timestamp_end | ``` Required ``` | The last timestamp to get data for. |
|
593
|
+
| fields | ``` Optional ``` ``` Collection ``` | Which fields to include in the response. Valid fields are those defined in the `AlertItem` schema. By default all fields are included. |
|
594
|
+
| sort_by | ``` Optional ``` ``` Collection ``` | Which fields to sort the response items by. By default the items are sorted by timestampStart. |
|
595
|
+
| sort_asc | ``` Optional ``` ``` DefaultValue ``` | Whether to sort the items in ascending order. |
|
596
|
+
| page_size | ``` Optional ``` ``` DefaultValue ``` | The number of items to return per page. |
|
597
|
+
| page | ``` Optional ``` ``` DefaultValue ``` | Which page to return when the number of items exceed the page size. |
|
598
|
+
|
599
|
+
|
600
|
+
#### Example Usage
|
601
|
+
|
602
|
+
```ruby
|
603
|
+
device_ids = [161]
|
604
|
+
timestamp_start = DateTime.now
|
605
|
+
timestamp_end = DateTime.now
|
606
|
+
fields = ['fields']
|
607
|
+
sort_by = ['sortBy']
|
608
|
+
sort_asc = false
|
609
|
+
page_size = 50
|
610
|
+
page = 1
|
611
|
+
|
612
|
+
result = alerts_controller.get_alerts(device_ids, timestamp_start, timestamp_end, fields, sort_by, sort_asc, page_size, page)
|
613
|
+
|
614
|
+
```
|
615
|
+
|
616
|
+
#### Errors
|
617
|
+
|
618
|
+
| Error Code | Error Description |
|
619
|
+
|------------|-------------------|
|
620
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
621
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
622
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
623
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
### <a name="get_alarms"></a>![Method: ](https://apidocs.io/img/method.png ".AlertsController.get_alarms") get_alarms
|
628
|
+
|
629
|
+
> _This endpoint is deprecated. Please use the new endpoint `/alerts.json` instead._
|
630
|
+
|
631
|
+
|
632
|
+
```ruby
|
633
|
+
def get_alarms(device_ids,
|
634
|
+
timestamp_start,
|
635
|
+
timestamp_end,
|
636
|
+
fields = nil,
|
637
|
+
sort_by = nil,
|
638
|
+
sort_asc = false,
|
639
|
+
page_size = 50,
|
640
|
+
page = 1); end
|
641
|
+
```
|
642
|
+
|
643
|
+
#### Parameters
|
644
|
+
|
645
|
+
| Parameter | Tags | Description |
|
646
|
+
|-----------|------|-------------|
|
647
|
+
| device_ids | ``` Required ``` ``` Collection ``` | What devices to get alerts for. |
|
648
|
+
| timestamp_start | ``` Required ``` | The first timestamp to get data for. |
|
649
|
+
| timestamp_end | ``` Required ``` | The last timestamp to get data for. |
|
650
|
+
| fields | ``` Optional ``` ``` Collection ``` | Which fields to include in the response. Valid fields are those defined in the `AlertItem` schema. By default all fields are included. |
|
651
|
+
| sort_by | ``` Optional ``` ``` Collection ``` | Which fields to sort the response items by. By default the items are sorted by timestampStart. |
|
652
|
+
| sort_asc | ``` Optional ``` ``` DefaultValue ``` | Whether to sort the items in ascending order. |
|
653
|
+
| page_size | ``` Optional ``` ``` DefaultValue ``` | The number of items to return per page. |
|
654
|
+
| page | ``` Optional ``` ``` DefaultValue ``` | Which page to return when the number of items exceed the page size. |
|
655
|
+
|
656
|
+
|
657
|
+
#### Example Usage
|
658
|
+
|
659
|
+
```ruby
|
660
|
+
device_ids = [161]
|
661
|
+
timestamp_start = DateTime.now
|
662
|
+
timestamp_end = DateTime.now
|
663
|
+
fields = ['fields']
|
664
|
+
sort_by = ['sortBy']
|
665
|
+
sort_asc = false
|
666
|
+
page_size = 50
|
667
|
+
page = 1
|
668
|
+
|
669
|
+
result = alerts_controller.get_alarms(device_ids, timestamp_start, timestamp_end, fields, sort_by, sort_asc, page_size, page)
|
670
|
+
|
671
|
+
```
|
672
|
+
|
673
|
+
#### Errors
|
674
|
+
|
675
|
+
| Error Code | Error Description |
|
676
|
+
|------------|-------------------|
|
677
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
678
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
679
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
680
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
681
|
+
|
682
|
+
|
683
|
+
|
684
|
+
[Back to List of Controllers](#list_of_controllers)
|
685
|
+
|
686
|
+
## <a name="configuration_data_controller"></a>![Class: ](https://apidocs.io/img/class.png ".ConfigurationDataController") ConfigurationDataController
|
687
|
+
|
688
|
+
### Get singleton instance
|
689
|
+
|
690
|
+
The singleton instance of the ``` ConfigurationDataController ``` class can be accessed from the API Client.
|
691
|
+
|
692
|
+
```ruby
|
693
|
+
configurationData_controller = client.configuration_data
|
694
|
+
```
|
695
|
+
|
696
|
+
### <a name="get_configuration"></a>![Method: ](https://apidocs.io/img/method.png ".ConfigurationDataController.get_configuration") get_configuration
|
697
|
+
|
698
|
+
> Gets your system-wide configuration data. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
699
|
+
|
700
|
+
|
701
|
+
```ruby
|
702
|
+
def get_configuration; end
|
703
|
+
```
|
704
|
+
|
705
|
+
#### Example Usage
|
706
|
+
|
707
|
+
```ruby
|
708
|
+
|
709
|
+
result = configurationData_controller.get_configuration()
|
710
|
+
|
711
|
+
```
|
712
|
+
|
713
|
+
#### Errors
|
714
|
+
|
715
|
+
| Error Code | Error Description |
|
716
|
+
|------------|-------------------|
|
717
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
718
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
719
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
720
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
721
|
+
|
722
|
+
|
723
|
+
|
724
|
+
[Back to List of Controllers](#list_of_controllers)
|
725
|
+
|
726
|
+
## <a name="assets_controller"></a>![Class: ](https://apidocs.io/img/class.png ".AssetsController") AssetsController
|
727
|
+
|
728
|
+
### Get singleton instance
|
729
|
+
|
730
|
+
The singleton instance of the ``` AssetsController ``` class can be accessed from the API Client.
|
731
|
+
|
732
|
+
```ruby
|
733
|
+
assets_controller = client.assets
|
734
|
+
```
|
735
|
+
|
736
|
+
### <a name="get_devices"></a>![Method: ](https://apidocs.io/img/method.png ".AssetsController.get_devices") get_devices
|
737
|
+
|
738
|
+
> Gets a list of devices that the API key has permissions for. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
739
|
+
|
740
|
+
|
741
|
+
```ruby
|
742
|
+
def get_devices(device_type_ids = nil,
|
743
|
+
site_ids = nil,
|
744
|
+
parent_ids = nil,
|
745
|
+
fields = nil,
|
746
|
+
page_size = 50,
|
747
|
+
page = 1); end
|
748
|
+
```
|
749
|
+
|
750
|
+
#### Parameters
|
751
|
+
|
752
|
+
| Parameter | Tags | Description |
|
753
|
+
|-----------|------|-------------|
|
754
|
+
| device_type_ids | ``` Optional ``` ``` Collection ``` | Which device types to get. Examples:
|
755
|
+
* 1 - Wind turbine
|
756
|
+
* 2 - Production meter
|
757
|
+
* 3 - Met mast
|
758
|
+
* 4 - Inverter
|
759
|
+
* 10 - Device group
|
760
|
+
* 11 - Grid meter
|
761
|
+
* 12 - Combiner box
|
762
|
+
* 23 - String |
|
763
|
+
| site_ids | ``` Optional ``` ``` Collection ``` | Only include devices at these sites. |
|
764
|
+
| parent_ids | ``` Optional ``` ``` Collection ``` | Only include devices with these parent devices. |
|
765
|
+
| fields | ``` Optional ``` ``` Collection ``` | Which fields to include in the response. Valid fields are those defined in the `Device` schema. By default all fields are included. |
|
766
|
+
| page_size | ``` Optional ``` ``` DefaultValue ``` | The number of items to return per page. |
|
767
|
+
| page | ``` Optional ``` ``` DefaultValue ``` | Which page to return when the number of items exceed the page size. |
|
768
|
+
|
769
|
+
|
770
|
+
#### Example Usage
|
771
|
+
|
772
|
+
```ruby
|
773
|
+
device_type_ids = [252]
|
774
|
+
site_ids = [252]
|
775
|
+
parent_ids = [252]
|
776
|
+
fields = ['fields']
|
777
|
+
page_size = 50
|
778
|
+
page = 1
|
779
|
+
|
780
|
+
result = assets_controller.get_devices(device_type_ids, site_ids, parent_ids, fields, page_size, page)
|
781
|
+
|
782
|
+
```
|
783
|
+
|
784
|
+
#### Errors
|
785
|
+
|
786
|
+
| Error Code | Error Description |
|
787
|
+
|------------|-------------------|
|
788
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
789
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
790
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
791
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
792
|
+
|
793
|
+
|
794
|
+
|
795
|
+
### <a name="get_sites"></a>![Method: ](https://apidocs.io/img/method.png ".AssetsController.get_sites") get_sites
|
796
|
+
|
797
|
+
> Gets a list of sites that the API key has permissions for. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
798
|
+
|
799
|
+
|
800
|
+
```ruby
|
801
|
+
def get_sites(fields = nil,
|
802
|
+
page_size = 50,
|
803
|
+
page = 1); end
|
804
|
+
```
|
805
|
+
|
806
|
+
#### Parameters
|
807
|
+
|
808
|
+
| Parameter | Tags | Description |
|
809
|
+
|-----------|------|-------------|
|
810
|
+
| fields | ``` Optional ``` ``` Collection ``` | Which fields to include in the response. Valid fields are those defined in the `SiteWithData` schema. By default all fields are included. |
|
811
|
+
| page_size | ``` Optional ``` ``` DefaultValue ``` | The number of items to return per page. |
|
812
|
+
| page | ``` Optional ``` ``` DefaultValue ``` | Which page to return when the number of items exceed the page size. |
|
813
|
+
|
814
|
+
|
815
|
+
#### Example Usage
|
816
|
+
|
817
|
+
```ruby
|
818
|
+
fields = ['fields']
|
819
|
+
page_size = 50
|
820
|
+
page = 1
|
821
|
+
|
822
|
+
result = assets_controller.get_sites(fields, page_size, page)
|
823
|
+
|
824
|
+
```
|
825
|
+
|
826
|
+
|
827
|
+
### <a name="get_power_curves"></a>![Method: ](https://apidocs.io/img/method.png ".AssetsController.get_power_curves") get_power_curves
|
828
|
+
|
829
|
+
> Gets the default or learned power curves for wind turbines. Other device types are not supported. This request can also be made using the POST method, with a JSON request body instead of query parameters.
|
830
|
+
|
831
|
+
|
832
|
+
```ruby
|
833
|
+
def get_power_curves(device_ids,
|
834
|
+
timestamp = nil,
|
835
|
+
learned = false); end
|
836
|
+
```
|
837
|
+
|
838
|
+
#### Parameters
|
839
|
+
|
840
|
+
| Parameter | Tags | Description |
|
841
|
+
|-----------|------|-------------|
|
842
|
+
| device_ids | ``` Required ``` ``` Collection ``` | What devices to get power curves for. Only wind turbines are supported. |
|
843
|
+
| timestamp | ``` Optional ``` | The date for which to get power curves. The default is the current date. |
|
844
|
+
| learned | ``` Optional ``` ``` DefaultValue ``` | Whether to get learned power curves instead of default power curves. |
|
845
|
+
|
846
|
+
|
847
|
+
#### Example Usage
|
848
|
+
|
849
|
+
```ruby
|
850
|
+
device_ids = [252]
|
851
|
+
timestamp = DateTime.now
|
852
|
+
learned = false
|
853
|
+
|
854
|
+
result = assets_controller.get_power_curves(device_ids, timestamp, learned)
|
855
|
+
|
856
|
+
```
|
857
|
+
|
858
|
+
#### Errors
|
859
|
+
|
860
|
+
| Error Code | Error Description |
|
861
|
+
|------------|-------------------|
|
862
|
+
| 400 | The request cannot be fulfilled due to bad syntax. |
|
863
|
+
| 401 | One of the following:<br>* The request is missing a valid API key.<br>* The API key does not authorize access the requested data. Devices<br> or data signals can be limited.<br> |
|
864
|
+
| 405 | The HTTP method is not allowed for the endpoint. |
|
865
|
+
| 429 | The API key has been used in too many requests in a given amount of time. The following headers will be set in the response:<br>* X-Rate-Limit-Limit - The total number of allowed requests for this period.<br>* X-Rate-Limit-Remaining - The remaining number of requests for this period.<br>* X-Rate-Limit-Reset - The number of seconds left until the end of this period.<br> |
|
866
|
+
|
867
|
+
|
868
|
+
|
869
|
+
[Back to List of Controllers](#list_of_controllers)
|
870
|
+
|
871
|
+
|
872
|
+
|