losant_rest 1.20.1 → 1.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +140 -14
- data/docs/_schemas.md +3150 -646
- data/docs/application.md +1 -0
- data/docs/devices.md +45 -2
- data/docs/instance.md +41 -0
- data/docs/instanceNotificationRule.md +219 -0
- data/docs/instanceNotificationRules.md +91 -0
- data/docs/instanceOrg.md +49 -5
- data/docs/instanceSandbox.md +179 -3
- data/docs/me.md +1 -0
- data/docs/org.md +1 -0
- data/lib/platform_rest/application.rb +2 -0
- data/lib/platform_rest/client.rb +10 -2
- data/lib/platform_rest/devices.rb +52 -2
- data/lib/platform_rest/instance.rb +50 -0
- data/lib/platform_rest/instance_notification_rule.rb +275 -0
- data/lib/platform_rest/instance_notification_rules.rb +136 -0
- data/lib/platform_rest/instance_org.rb +57 -5
- data/lib/platform_rest/instance_sandbox.rb +211 -3
- data/lib/platform_rest/me.rb +2 -0
- data/lib/platform_rest/org.rb +2 -0
- data/lib/platform_rest/version.rb +1 -1
- data/lib/platform_rest.rb +2 -0
- data/schemas/advancedDeviceQuery.json +103 -0
- data/schemas/apiTokenPost.json +16 -0
- data/schemas/applicationSearchResult.json +46 -6
- data/schemas/bulkRestoreResponse.json +12 -0
- data/schemas/credentialLinkedResources.json +12 -0
- data/schemas/dataExport.json +103 -0
- data/schemas/device.json +4 -0
- data/schemas/devices.json +4 -0
- data/schemas/devicesDeleteOrRestorePost.json +2061 -0
- data/schemas/devicesExportPayloadCountPost.json +103 -0
- data/schemas/devicesExportPost.json +103 -0
- data/schemas/devicesPatch.json +103 -0
- data/schemas/devicesRemoveDataPost.json +103 -0
- data/schemas/experienceEndpoint.json +6 -1
- data/schemas/experienceEndpointPatch.json +6 -1
- data/schemas/experienceEndpointPost.json +6 -1
- data/schemas/experienceEndpoints.json +6 -1
- data/schemas/experienceLinkedResources.json +18 -1
- data/schemas/flow.json +4 -0
- data/schemas/flowPatch.json +4 -0
- data/schemas/flowPost.json +4 -0
- data/schemas/flowVersion.json +8 -0
- data/schemas/flowVersionPost.json +4 -0
- data/schemas/flowVersions.json +8 -0
- data/schemas/flows.json +4 -0
- data/schemas/flowsImportPost.json +8 -0
- data/schemas/flowsImportResult.json +12 -0
- data/schemas/githubLogin.json +16 -0
- data/schemas/instance.json +9 -0
- data/schemas/instanceAuditLog.json +2 -1
- data/schemas/instanceAuditLogFilter.json +2 -1
- data/schemas/instanceOrg.json +4 -0
- data/schemas/instanceOrgs.json +4 -0
- data/schemas/instances.json +9 -0
- data/schemas/lastValueQuery.json +103 -0
- data/schemas/multiDeviceCommand.json +103 -0
- data/schemas/notificationRule.json +161 -0
- data/schemas/notificationRuleDeliveryLogs.json +123 -0
- data/schemas/notificationRuleEvaluationOptions.json +10 -0
- data/schemas/notificationRulePatch.json +128 -0
- data/schemas/notificationRulePost.json +140 -0
- data/schemas/notificationRules.json +212 -0
- data/schemas/samlResponse.json +16 -0
- data/schemas/timeSeriesQuery.json +103 -0
- data/schemas/userCredentials.json +16 -0
- data/schemas/userPost.json +16 -0
- metadata +14 -2
data/docs/instanceSandbox.md
CHANGED
@@ -7,7 +7,11 @@ parameters and the potential responses.
|
|
7
7
|
##### Contents
|
8
8
|
|
9
9
|
* [Delete](#delete)
|
10
|
+
* [Device Counts](#device-counts)
|
10
11
|
* [Get](#get)
|
12
|
+
* [Notebook Minute Counts](#notebook-minute-counts)
|
13
|
+
* [Payload Counts](#payload-counts)
|
14
|
+
* [Payload Counts Breakdown](#payload-counts-breakdown)
|
11
15
|
* [Undelete](#undelete)
|
12
16
|
|
13
17
|
<br/>
|
@@ -48,7 +52,49 @@ all.Instance, all.User, instanceSandbox.*, or instanceSandbox.delete.
|
|
48
52
|
| Code | Type | Description |
|
49
53
|
| ---- | ---- | ----------- |
|
50
54
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
51
|
-
| 404 | [Error](_schemas.md#error) | Error if
|
55
|
+
| 404 | [Error](_schemas.md#error) | Error if sandbox or instance was not found |
|
56
|
+
|
57
|
+
<br/>
|
58
|
+
|
59
|
+
## Device Counts
|
60
|
+
|
61
|
+
Returns device counts by day for the time range specified for all applications the sandbox user owns
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
result = client.instance_sandbox.device_counts(
|
65
|
+
instanceId: my_instance_id,
|
66
|
+
instanceSandboxId: my_instance_sandbox_id)
|
67
|
+
|
68
|
+
puts result
|
69
|
+
```
|
70
|
+
|
71
|
+
#### Authentication
|
72
|
+
The client must be configured with a valid api access token to call this
|
73
|
+
action. The token must include at least one of the following scopes:
|
74
|
+
all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.deviceCounts.
|
75
|
+
|
76
|
+
#### Available Parameters
|
77
|
+
|
78
|
+
| Name | Type | Required | Description | Default | Example |
|
79
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
80
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
81
|
+
| instanceSandboxId | string | Y | ID associated with the sandbox user | | 575ec8687ae143cd83dc4a97 |
|
82
|
+
| start | string | N | Start of range for device count query (ms since epoch) | | 0 |
|
83
|
+
| end | string | N | End of range for device count query (ms since epoch) | | 1465790400000 |
|
84
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
85
|
+
|
86
|
+
#### Successful Responses
|
87
|
+
|
88
|
+
| Code | Type | Description |
|
89
|
+
| ---- | ---- | ----------- |
|
90
|
+
| 200 | [Device Counts](_schemas.md#device-counts) | Device counts by day |
|
91
|
+
|
92
|
+
#### Error Responses
|
93
|
+
|
94
|
+
| Code | Type | Description |
|
95
|
+
| ---- | ---- | ----------- |
|
96
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
97
|
+
| 404 | [Error](_schemas.md#error) | Error if sandbox or instance was not found |
|
52
98
|
|
53
99
|
<br/>
|
54
100
|
|
@@ -90,7 +136,137 @@ all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or
|
|
90
136
|
| Code | Type | Description |
|
91
137
|
| ---- | ---- | ----------- |
|
92
138
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
93
|
-
| 404 | [Error](_schemas.md#error) | Error if sandbox was not found |
|
139
|
+
| 404 | [Error](_schemas.md#error) | Error if sandbox or instance was not found |
|
140
|
+
|
141
|
+
<br/>
|
142
|
+
|
143
|
+
## Notebook Minute Counts
|
144
|
+
|
145
|
+
Returns notebook execution usage by day for the time range specified for all applications the sandbox user owns
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
result = client.instance_sandbox.notebook_minute_counts(
|
149
|
+
instanceId: my_instance_id,
|
150
|
+
instanceSandboxId: my_instance_sandbox_id)
|
151
|
+
|
152
|
+
puts result
|
153
|
+
```
|
154
|
+
|
155
|
+
#### Authentication
|
156
|
+
The client must be configured with a valid api access token to call this
|
157
|
+
action. The token must include at least one of the following scopes:
|
158
|
+
all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.notebookMinuteCounts.
|
159
|
+
|
160
|
+
#### Available Parameters
|
161
|
+
|
162
|
+
| Name | Type | Required | Description | Default | Example |
|
163
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
164
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
165
|
+
| instanceSandboxId | string | Y | ID associated with the sandbox user | | 575ec8687ae143cd83dc4a97 |
|
166
|
+
| start | string | N | Start of range for notebook execution query (ms since epoch) | | 0 |
|
167
|
+
| end | string | N | End of range for notebook execution query (ms since epoch) | | 1465790400000 |
|
168
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
169
|
+
|
170
|
+
#### Successful Responses
|
171
|
+
|
172
|
+
| Code | Type | Description |
|
173
|
+
| ---- | ---- | ----------- |
|
174
|
+
| 200 | [Notebook Minute Counts](_schemas.md#notebook-minute-counts) | Notebook usage information |
|
175
|
+
|
176
|
+
#### Error Responses
|
177
|
+
|
178
|
+
| Code | Type | Description |
|
179
|
+
| ---- | ---- | ----------- |
|
180
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
181
|
+
| 404 | [Error](_schemas.md#error) | Error if sandbox or instance was not found |
|
182
|
+
|
183
|
+
<br/>
|
184
|
+
|
185
|
+
## Payload Counts
|
186
|
+
|
187
|
+
Returns payload counts for the time range specified for all applications the sandbox user owns
|
188
|
+
|
189
|
+
```ruby
|
190
|
+
result = client.instance_sandbox.payload_counts(
|
191
|
+
instanceId: my_instance_id,
|
192
|
+
instanceSandboxId: my_instance_sandbox_id)
|
193
|
+
|
194
|
+
puts result
|
195
|
+
```
|
196
|
+
|
197
|
+
#### Authentication
|
198
|
+
The client must be configured with a valid api access token to call this
|
199
|
+
action. The token must include at least one of the following scopes:
|
200
|
+
all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.payloadCounts.
|
201
|
+
|
202
|
+
#### Available Parameters
|
203
|
+
|
204
|
+
| Name | Type | Required | Description | Default | Example |
|
205
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
206
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
207
|
+
| instanceSandboxId | string | Y | ID associated with the sandbox user | | 575ec8687ae143cd83dc4a97 |
|
208
|
+
| start | string | N | Start of range for payload count query (ms since epoch) | | 0 |
|
209
|
+
| end | string | N | End of range for payload count query (ms since epoch) | | 1465790400000 |
|
210
|
+
| asBytes | string | N | If the resulting stats should be returned as bytes | false | true |
|
211
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
212
|
+
|
213
|
+
#### Successful Responses
|
214
|
+
|
215
|
+
| Code | Type | Description |
|
216
|
+
| ---- | ---- | ----------- |
|
217
|
+
| 200 | [Payload Stats](_schemas.md#payload-stats) | Payload counts, by type and source |
|
218
|
+
|
219
|
+
#### Error Responses
|
220
|
+
|
221
|
+
| Code | Type | Description |
|
222
|
+
| ---- | ---- | ----------- |
|
223
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
224
|
+
| 404 | [Error](_schemas.md#error) | Error if sandbox or instance was not found |
|
225
|
+
|
226
|
+
<br/>
|
227
|
+
|
228
|
+
## Payload Counts Breakdown
|
229
|
+
|
230
|
+
Returns payload counts per resolution in the time range specified for all applications the sandbox user owns
|
231
|
+
|
232
|
+
```ruby
|
233
|
+
result = client.instance_sandbox.payload_counts_breakdown(
|
234
|
+
instanceId: my_instance_id,
|
235
|
+
instanceSandboxId: my_instance_sandbox_id)
|
236
|
+
|
237
|
+
puts result
|
238
|
+
```
|
239
|
+
|
240
|
+
#### Authentication
|
241
|
+
The client must be configured with a valid api access token to call this
|
242
|
+
action. The token must include at least one of the following scopes:
|
243
|
+
all.Instance, all.Instance.read, all.User, all.User.read, instanceSandbox.*, or instanceSandbox.payloadCountsBreakdown.
|
244
|
+
|
245
|
+
#### Available Parameters
|
246
|
+
|
247
|
+
| Name | Type | Required | Description | Default | Example |
|
248
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
249
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
250
|
+
| instanceSandboxId | string | Y | ID associated with the sandbox user | | 575ec8687ae143cd83dc4a97 |
|
251
|
+
| start | string | N | Start of range for payload count query (ms since epoch) | | 0 |
|
252
|
+
| end | string | N | End of range for payload count query (ms since epoch) | | 1465790400000 |
|
253
|
+
| resolution | string | N | Resolution in milliseconds. Accepted values are: 86400000, 3600000 | 86400000 | 86400000 |
|
254
|
+
| asBytes | string | N | If the resulting stats should be returned as bytes | false | true |
|
255
|
+
| includeNonBillable | string | N | If non-billable payloads should be included in the result | false | true |
|
256
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
257
|
+
|
258
|
+
#### Successful Responses
|
259
|
+
|
260
|
+
| Code | Type | Description |
|
261
|
+
| ---- | ---- | ----------- |
|
262
|
+
| 200 | [Payload Counts Breakdown](_schemas.md#payload-counts-breakdown) | Sum of payload counts by date |
|
263
|
+
|
264
|
+
#### Error Responses
|
265
|
+
|
266
|
+
| Code | Type | Description |
|
267
|
+
| ---- | ---- | ----------- |
|
268
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
269
|
+
| 404 | [Error](_schemas.md#error) | Error if sandbox or instance was not found |
|
94
270
|
|
95
271
|
<br/>
|
96
272
|
|
@@ -132,4 +308,4 @@ all.Instance, all.User, instanceSandbox.*, or instanceSandbox.undelete.
|
|
132
308
|
| Code | Type | Description |
|
133
309
|
| ---- | ---- | ----------- |
|
134
310
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
135
|
-
| 404 | [Error](_schemas.md#error) | Error if sandbox was not found |
|
311
|
+
| 404 | [Error](_schemas.md#error) | Error if sandbox or instance was not found |
|
data/docs/me.md
CHANGED
@@ -558,6 +558,7 @@ all.User, all.User.read, me.*, or me.payloadCounts.
|
|
558
558
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
559
559
|
| start | string | N | Start of range for payload count query (ms since epoch) | | 0 |
|
560
560
|
| end | string | N | End of range for payload count query (ms since epoch) | | 1465790400000 |
|
561
|
+
| asBytes | string | N | If the resulting stats should be returned as bytes | false | true |
|
561
562
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
562
563
|
|
563
564
|
#### Successful Responses
|
data/docs/org.md
CHANGED
@@ -322,6 +322,7 @@ all.Organization, all.Organization.read, all.User, all.User.read, org.*, or org.
|
|
322
322
|
| orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
|
323
323
|
| start | string | N | Start of range for payload count query (ms since epoch) | | 0 |
|
324
324
|
| end | string | N | End of range for payload count query (ms since epoch) | | 1465790400000 |
|
325
|
+
| asBytes | string | N | If the resulting stats should be returned as bytes | false | true |
|
325
326
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
326
327
|
|
327
328
|
#### Successful Responses
|
@@ -748,6 +748,7 @@ module PlatformRest
|
|
748
748
|
# * {string} applicationId - ID of the associated application
|
749
749
|
# * {string} start - Start of range for payload count query (ms since epoch)
|
750
750
|
# * {string} end - End of range for payload count query (ms since epoch)
|
751
|
+
# * {string} asBytes - If the resulting stats should be returned as bytes
|
751
752
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
752
753
|
# * {boolean} _actions - Return resource actions in response
|
753
754
|
# * {boolean} _links - Return resource link in response
|
@@ -769,6 +770,7 @@ module PlatformRest
|
|
769
770
|
|
770
771
|
query_params[:start] = params[:start] if params.has_key?(:start)
|
771
772
|
query_params[:end] = params[:end] if params.has_key?(:end)
|
773
|
+
query_params[:asBytes] = params[:asBytes] if params.has_key?(:asBytes)
|
772
774
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
773
775
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
774
776
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
data/lib/platform_rest/client.rb
CHANGED
@@ -27,7 +27,7 @@ module PlatformRest
|
|
27
27
|
#
|
28
28
|
# User API for accessing platform data
|
29
29
|
#
|
30
|
-
# Built For Version 1.
|
30
|
+
# Built For Version 1.27.1
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -300,6 +300,14 @@ module PlatformRest
|
|
300
300
|
@instance_members ||= InstanceMembers.new(self)
|
301
301
|
end
|
302
302
|
|
303
|
+
def instance_notification_rule
|
304
|
+
@instance_notification_rule ||= InstanceNotificationRule.new(self)
|
305
|
+
end
|
306
|
+
|
307
|
+
def instance_notification_rules
|
308
|
+
@instance_notification_rules ||= InstanceNotificationRules.new(self)
|
309
|
+
end
|
310
|
+
|
303
311
|
def instance_org
|
304
312
|
@instance_org ||= InstanceOrg.new(self)
|
305
313
|
end
|
@@ -398,7 +406,7 @@ module PlatformRest
|
|
398
406
|
|
399
407
|
headers["Accept"] = "application/json"
|
400
408
|
headers["Content-Type"] = "application/json"
|
401
|
-
headers["Accept-Version"] = "^1.
|
409
|
+
headers["Accept-Version"] = "^1.27.1"
|
402
410
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
403
411
|
path = self.url + options.fetch(:path, "")
|
404
412
|
|
@@ -92,7 +92,7 @@ module PlatformRest
|
|
92
92
|
#
|
93
93
|
# Parameters:
|
94
94
|
# * {string} applicationId - ID associated with the application
|
95
|
-
# * {hash} options - Object containing device
|
95
|
+
# * {hash} options - Object containing device deletion options (https://api.losant.com/#/definitions/devicesDeleteOrRestorePost)
|
96
96
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
97
97
|
# * {boolean} _actions - Return resource actions in response
|
98
98
|
# * {boolean} _links - Return resource link in response
|
@@ -239,7 +239,7 @@ module PlatformRest
|
|
239
239
|
#
|
240
240
|
# Parameters:
|
241
241
|
# * {string} applicationId - ID associated with the application
|
242
|
-
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, connectionStatus
|
242
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, connectionStatus, deletedAt
|
243
243
|
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
244
244
|
# * {string} page - Which page of results to return
|
245
245
|
# * {string} perPage - How many items to return per page
|
@@ -252,6 +252,7 @@ module PlatformRest
|
|
252
252
|
# * {hash} query - Device filter JSON object which overrides the filterField, filter, deviceClass, tagFilter, and parentId parameters. (https://api.losant.com/#/definitions/advancedDeviceQuery)
|
253
253
|
# * {string} tagsAsObject - Return tags as an object map instead of an array
|
254
254
|
# * {string} attributesAsObject - Return attributes as an object map instead of an array
|
255
|
+
# * {string} queryDeleted - If true, endpoint will return recently deleted devices instead
|
255
256
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
256
257
|
# * {boolean} _actions - Return resource actions in response
|
257
258
|
# * {boolean} _links - Return resource link in response
|
@@ -285,6 +286,7 @@ module PlatformRest
|
|
285
286
|
query_params[:query] = JSON.dump(query_params[:query]) if query_params.has_key?(:query)
|
286
287
|
query_params[:tagsAsObject] = params[:tagsAsObject] if params.has_key?(:tagsAsObject)
|
287
288
|
query_params[:attributesAsObject] = params[:attributesAsObject] if params.has_key?(:attributesAsObject)
|
289
|
+
query_params[:queryDeleted] = params[:queryDeleted] if params.has_key?(:queryDeleted)
|
288
290
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
289
291
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
290
292
|
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
@@ -553,6 +555,54 @@ module PlatformRest
|
|
553
555
|
body: body)
|
554
556
|
end
|
555
557
|
|
558
|
+
# Restore deleted devices
|
559
|
+
#
|
560
|
+
# Authentication:
|
561
|
+
# The client must be configured with a valid api
|
562
|
+
# access token to call this action. The token
|
563
|
+
# must include at least one of the following scopes:
|
564
|
+
# all.Application, all.Organization, all.User, devices.*, or devices.restore.
|
565
|
+
#
|
566
|
+
# Parameters:
|
567
|
+
# * {string} applicationId - ID associated with the application
|
568
|
+
# * {hash} options - Object containing device restoration options (https://api.losant.com/#/definitions/devicesDeleteOrRestorePost)
|
569
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
570
|
+
# * {boolean} _actions - Return resource actions in response
|
571
|
+
# * {boolean} _links - Return resource link in response
|
572
|
+
# * {boolean} _embedded - Return embedded resources in response
|
573
|
+
#
|
574
|
+
# Responses:
|
575
|
+
# * 200 - Object indicating number of devices restored or failed (https://api.losant.com/#/definitions/bulkRestoreResponse)
|
576
|
+
# * 202 - If a job was enqueued for the devices to be restored (https://api.losant.com/#/definitions/jobEnqueuedResult)
|
577
|
+
#
|
578
|
+
# Errors:
|
579
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
580
|
+
# * 404 - Error if application was not found (https://api.losant.com/#/definitions/error)
|
581
|
+
def restore(params = {})
|
582
|
+
params = Utils.symbolize_hash_keys(params)
|
583
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
584
|
+
headers = {}
|
585
|
+
body = nil
|
586
|
+
|
587
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
588
|
+
raise ArgumentError.new("options is required") unless params.has_key?(:options)
|
589
|
+
|
590
|
+
body = params[:options] if params.has_key?(:options)
|
591
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
592
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
593
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
594
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
595
|
+
|
596
|
+
path = "/applications/#{params[:applicationId]}/devices/restore"
|
597
|
+
|
598
|
+
@client.request(
|
599
|
+
method: :post,
|
600
|
+
path: path,
|
601
|
+
query: query_params,
|
602
|
+
headers: headers,
|
603
|
+
body: body)
|
604
|
+
end
|
605
|
+
|
556
606
|
# Send a command to multiple devices
|
557
607
|
#
|
558
608
|
# Authentication:
|
@@ -319,6 +319,56 @@ module PlatformRest
|
|
319
319
|
body: body)
|
320
320
|
end
|
321
321
|
|
322
|
+
# Returns payload counts for the time range specified for this instance
|
323
|
+
#
|
324
|
+
# Authentication:
|
325
|
+
# The client must be configured with a valid api
|
326
|
+
# access token to call this action. The token
|
327
|
+
# must include at least one of the following scopes:
|
328
|
+
# all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.payloadCounts.
|
329
|
+
#
|
330
|
+
# Parameters:
|
331
|
+
# * {string} instanceId - ID associated with the instance
|
332
|
+
# * {string} start - Start of range for payload count query (ms since epoch)
|
333
|
+
# * {string} end - End of range for payload count query (ms since epoch)
|
334
|
+
# * {string} asBytes - If the resulting stats should be returned as bytes
|
335
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
336
|
+
# * {boolean} _actions - Return resource actions in response
|
337
|
+
# * {boolean} _links - Return resource link in response
|
338
|
+
# * {boolean} _embedded - Return embedded resources in response
|
339
|
+
#
|
340
|
+
# Responses:
|
341
|
+
# * 200 - Payload counts, by type and source (https://api.losant.com/#/definitions/payloadStats)
|
342
|
+
#
|
343
|
+
# Errors:
|
344
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
345
|
+
# * 404 - Error if instance was not found (https://api.losant.com/#/definitions/error)
|
346
|
+
def payload_counts(params = {})
|
347
|
+
params = Utils.symbolize_hash_keys(params)
|
348
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
349
|
+
headers = {}
|
350
|
+
body = nil
|
351
|
+
|
352
|
+
raise ArgumentError.new("instanceId is required") unless params.has_key?(:instanceId)
|
353
|
+
|
354
|
+
query_params[:start] = params[:start] if params.has_key?(:start)
|
355
|
+
query_params[:end] = params[:end] if params.has_key?(:end)
|
356
|
+
query_params[:asBytes] = params[:asBytes] if params.has_key?(:asBytes)
|
357
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
358
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
359
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
360
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
361
|
+
|
362
|
+
path = "/instances/#{params[:instanceId]}/payloadCounts"
|
363
|
+
|
364
|
+
@client.request(
|
365
|
+
method: :get,
|
366
|
+
path: path,
|
367
|
+
query: query_params,
|
368
|
+
headers: headers,
|
369
|
+
body: body)
|
370
|
+
end
|
371
|
+
|
322
372
|
# Returns payload counts per resolution in the time range specified for this instance
|
323
373
|
#
|
324
374
|
# Authentication:
|