losant_rest 1.21.0 → 1.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/docs/_schemas.md +1180 -72
- data/docs/application.md +1 -0
- data/docs/devices.md +45 -2
- data/docs/instance.md +41 -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 +2 -2
- data/lib/platform_rest/devices.rb +52 -2
- data/lib/platform_rest/instance.rb +50 -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/schemas/advancedDeviceQuery.json +103 -0
- data/schemas/apiTokenPost.json +7 -0
- data/schemas/bulkRestoreResponse.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/githubLogin.json +7 -0
- data/schemas/lastValueQuery.json +103 -0
- data/schemas/multiDeviceCommand.json +103 -0
- data/schemas/samlResponse.json +7 -0
- data/schemas/timeSeriesQuery.json +103 -0
- data/schemas/userCredentials.json +7 -0
- data/schemas/userPost.json +7 -0
- metadata +4 -2
data/docs/application.md
CHANGED
@@ -682,6 +682,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
682
682
|
| applicationId | string | Y | ID of the associated application | | 575ec8687ae143cd83dc4a97 |
|
683
683
|
| start | string | N | Start of range for payload count query (ms since epoch) | -2592000000 | 0 |
|
684
684
|
| end | string | N | End of range for payload count query (ms since epoch) | 0 | 1465790400000 |
|
685
|
+
| asBytes | string | N | If the resulting stats should be returned as bytes | false | true |
|
685
686
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
686
687
|
|
687
688
|
#### Successful Responses
|
data/docs/devices.md
CHANGED
@@ -16,6 +16,7 @@ parameters and the potential responses.
|
|
16
16
|
* [Payload Counts](#payload-counts)
|
17
17
|
* [Post](#post)
|
18
18
|
* [Remove Data](#remove-data)
|
19
|
+
* [Restore](#restore)
|
19
20
|
* [Send Command](#send-command)
|
20
21
|
* [Tag Keys](#tag-keys)
|
21
22
|
* [Tag Values](#tag-values)
|
@@ -84,7 +85,7 @@ all.Application, all.Organization, all.User, devices.*, or devices.delete.
|
|
84
85
|
| Name | Type | Required | Description | Default | Example |
|
85
86
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
86
87
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
87
|
-
| options | [Devices Delete Post](_schemas.md#devices-delete-post) | Y | Object containing device
|
88
|
+
| options | [Devices Delete Or Restore Post](_schemas.md#devices-delete-or-restore-post) | Y | Object containing device deletion options | | [Devices Delete Or Restore Post Example](_schemas.md#devices-delete-or-restore-post-example) |
|
88
89
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
89
90
|
|
90
91
|
#### Successful Responses
|
@@ -202,7 +203,7 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
202
203
|
| Name | Type | Required | Description | Default | Example |
|
203
204
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
204
205
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
205
|
-
| sortField | string | N | Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, connectionStatus | name | name |
|
206
|
+
| sortField | string | N | Field to sort the results by. Accepted values are: name, id, creationDate, lastUpdated, connectionStatus, deletedAt | name | name |
|
206
207
|
| sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
|
207
208
|
| page | string | N | Which page of results to return | 0 | 0 |
|
208
209
|
| perPage | string | N | How many items to return per page | 100 | 10 |
|
@@ -215,6 +216,7 @@ all.Application, all.Application.read, all.Device, all.Device.read, all.Organiza
|
|
215
216
|
| query | [Advanced Device Query](_schemas.md#advanced-device-query) | N | Device filter JSON object which overrides the filterField, filter, deviceClass, tagFilter, and parentId parameters. | | [Advanced Device Query Example](_schemas.md#advanced-device-query-example) |
|
216
217
|
| tagsAsObject | string | N | Return tags as an object map instead of an array | | true |
|
217
218
|
| attributesAsObject | string | N | Return attributes as an object map instead of an array | | false |
|
219
|
+
| queryDeleted | string | N | If true, endpoint will return recently deleted devices instead | | false |
|
218
220
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
219
221
|
|
220
222
|
#### Successful Responses
|
@@ -438,6 +440,47 @@ all.Application, all.Organization, all.User, devices.*, or devices.removeData.
|
|
438
440
|
|
439
441
|
<br/>
|
440
442
|
|
443
|
+
## Restore
|
444
|
+
|
445
|
+
Restore deleted devices
|
446
|
+
|
447
|
+
```ruby
|
448
|
+
result = client.devices.restore(
|
449
|
+
applicationId: my_application_id,
|
450
|
+
options: my_options)
|
451
|
+
|
452
|
+
puts result
|
453
|
+
```
|
454
|
+
|
455
|
+
#### Authentication
|
456
|
+
The client must be configured with a valid api access token to call this
|
457
|
+
action. The token must include at least one of the following scopes:
|
458
|
+
all.Application, all.Organization, all.User, devices.*, or devices.restore.
|
459
|
+
|
460
|
+
#### Available Parameters
|
461
|
+
|
462
|
+
| Name | Type | Required | Description | Default | Example |
|
463
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
464
|
+
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
465
|
+
| options | [Devices Delete Or Restore Post](_schemas.md#devices-delete-or-restore-post) | Y | Object containing device restoration options | | [Devices Delete Or Restore Post Example](_schemas.md#devices-delete-or-restore-post-example) |
|
466
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
467
|
+
|
468
|
+
#### Successful Responses
|
469
|
+
|
470
|
+
| Code | Type | Description |
|
471
|
+
| ---- | ---- | ----------- |
|
472
|
+
| 200 | [Bulk Restoration Response](_schemas.md#bulk-restoration-response) | Object indicating number of devices restored or failed |
|
473
|
+
| 202 | [Job Enqueued API Result](_schemas.md#job-enqueued-api-result) | If a job was enqueued for the devices to be restored |
|
474
|
+
|
475
|
+
#### Error Responses
|
476
|
+
|
477
|
+
| Code | Type | Description |
|
478
|
+
| ---- | ---- | ----------- |
|
479
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
480
|
+
| 404 | [Error](_schemas.md#error) | Error if application was not found |
|
481
|
+
|
482
|
+
<br/>
|
483
|
+
|
441
484
|
## Send Command
|
442
485
|
|
443
486
|
Send a command to multiple devices
|
data/docs/instance.md
CHANGED
@@ -12,6 +12,7 @@ parameters and the potential responses.
|
|
12
12
|
* [Historical Summaries](#historical-summaries)
|
13
13
|
* [Notebook Minute Counts](#notebook-minute-counts)
|
14
14
|
* [Patch](#patch)
|
15
|
+
* [Payload Counts](#payload-counts)
|
15
16
|
* [Payload Counts Breakdown](#payload-counts-breakdown)
|
16
17
|
|
17
18
|
<br/>
|
@@ -250,6 +251,46 @@ all.Instance, all.User, instance.*, or instance.patch.
|
|
250
251
|
|
251
252
|
<br/>
|
252
253
|
|
254
|
+
## Payload Counts
|
255
|
+
|
256
|
+
Returns payload counts for the time range specified for this instance
|
257
|
+
|
258
|
+
```ruby
|
259
|
+
result = client.instance.payload_counts(instanceId: my_instance_id)
|
260
|
+
|
261
|
+
puts result
|
262
|
+
```
|
263
|
+
|
264
|
+
#### Authentication
|
265
|
+
The client must be configured with a valid api access token to call this
|
266
|
+
action. The token must include at least one of the following scopes:
|
267
|
+
all.Instance, all.Instance.read, all.User, all.User.read, instance.*, or instance.payloadCounts.
|
268
|
+
|
269
|
+
#### Available Parameters
|
270
|
+
|
271
|
+
| Name | Type | Required | Description | Default | Example |
|
272
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
273
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
274
|
+
| start | string | N | Start of range for payload count query (ms since epoch) | | 0 |
|
275
|
+
| end | string | N | End of range for payload count query (ms since epoch) | | 1465790400000 |
|
276
|
+
| asBytes | string | N | If the resulting stats should be returned as bytes | false | true |
|
277
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
278
|
+
|
279
|
+
#### Successful Responses
|
280
|
+
|
281
|
+
| Code | Type | Description |
|
282
|
+
| ---- | ---- | ----------- |
|
283
|
+
| 200 | [Payload Stats](_schemas.md#payload-stats) | Payload counts, by type and source |
|
284
|
+
|
285
|
+
#### Error Responses
|
286
|
+
|
287
|
+
| Code | Type | Description |
|
288
|
+
| ---- | ---- | ----------- |
|
289
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
290
|
+
| 404 | [Error](_schemas.md#error) | Error if instance was not found |
|
291
|
+
|
292
|
+
<br/>
|
293
|
+
|
253
294
|
## Payload Counts Breakdown
|
254
295
|
|
255
296
|
Returns payload counts per resolution in the time range specified for this instance
|
data/docs/instanceOrg.md
CHANGED
@@ -11,6 +11,7 @@ parameters and the potential responses.
|
|
11
11
|
* [Get](#get)
|
12
12
|
* [Notebook Minute Counts](#notebook-minute-counts)
|
13
13
|
* [Patch](#patch)
|
14
|
+
* [Payload Counts](#payload-counts)
|
14
15
|
* [Payload Counts Breakdown](#payload-counts-breakdown)
|
15
16
|
|
16
17
|
<br/>
|
@@ -51,7 +52,7 @@ all.Instance, all.User, instanceOrg.*, or instanceOrg.delete.
|
|
51
52
|
| Code | Type | Description |
|
52
53
|
| ---- | ---- | ----------- |
|
53
54
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
54
|
-
| 404 | [Error](_schemas.md#error) | Error if organization was not found |
|
55
|
+
| 404 | [Error](_schemas.md#error) | Error if instance or organization was not found |
|
55
56
|
|
56
57
|
<br/>
|
57
58
|
|
@@ -134,7 +135,7 @@ all.Instance, all.Instance.read, all.User, all.User.read, instanceOrg.*, or inst
|
|
134
135
|
| Code | Type | Description |
|
135
136
|
| ---- | ---- | ----------- |
|
136
137
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
137
|
-
| 404 | [Error](_schemas.md#error) | Error if organization was not found |
|
138
|
+
| 404 | [Error](_schemas.md#error) | Error if instance or organization was not found |
|
138
139
|
|
139
140
|
<br/>
|
140
141
|
|
@@ -176,7 +177,7 @@ all.Instance, all.Instance.read, all.User, all.User.read, instanceOrg.*, or inst
|
|
176
177
|
| Code | Type | Description |
|
177
178
|
| ---- | ---- | ----------- |
|
178
179
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
179
|
-
| 404 | [Error](_schemas.md#error) | Error if organization was not found |
|
180
|
+
| 404 | [Error](_schemas.md#error) | Error if instance or organization was not found |
|
180
181
|
|
181
182
|
<br/>
|
182
183
|
|
@@ -219,7 +220,50 @@ all.Instance, all.User, instanceOrg.*, or instanceOrg.patch.
|
|
219
220
|
| Code | Type | Description |
|
220
221
|
| ---- | ---- | ----------- |
|
221
222
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
222
|
-
| 404 | [Error](_schemas.md#error) | Error if organization was not found |
|
223
|
+
| 404 | [Error](_schemas.md#error) | Error if instance or organization was not found |
|
224
|
+
|
225
|
+
<br/>
|
226
|
+
|
227
|
+
## Payload Counts
|
228
|
+
|
229
|
+
Returns payload counts for the time range specified for all applications this organization owns
|
230
|
+
|
231
|
+
```ruby
|
232
|
+
result = client.instance_org.payload_counts(
|
233
|
+
instanceId: my_instance_id,
|
234
|
+
orgId: my_org_id)
|
235
|
+
|
236
|
+
puts result
|
237
|
+
```
|
238
|
+
|
239
|
+
#### Authentication
|
240
|
+
The client must be configured with a valid api access token to call this
|
241
|
+
action. The token must include at least one of the following scopes:
|
242
|
+
all.Instance, all.Instance.read, all.User, all.User.read, instanceOrg.*, or instanceOrg.payloadCounts.
|
243
|
+
|
244
|
+
#### Available Parameters
|
245
|
+
|
246
|
+
| Name | Type | Required | Description | Default | Example |
|
247
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
248
|
+
| instanceId | string | Y | ID associated with the instance | | 575ec8687ae143cd83dc4a97 |
|
249
|
+
| orgId | string | Y | ID associated with the organization | | 575ed6e87ae143cd83dc4aa8 |
|
250
|
+
| start | string | N | Start of range for payload count query (ms since epoch) | | 0 |
|
251
|
+
| end | string | N | End of range for payload count query (ms since epoch) | | 1465790400000 |
|
252
|
+
| asBytes | string | N | If the resulting stats should be returned as bytes | false | true |
|
253
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
254
|
+
|
255
|
+
#### Successful Responses
|
256
|
+
|
257
|
+
| Code | Type | Description |
|
258
|
+
| ---- | ---- | ----------- |
|
259
|
+
| 200 | [Payload Stats](_schemas.md#payload-stats) | Payload counts, by type and source |
|
260
|
+
|
261
|
+
#### Error Responses
|
262
|
+
|
263
|
+
| Code | Type | Description |
|
264
|
+
| ---- | ---- | ----------- |
|
265
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
266
|
+
| 404 | [Error](_schemas.md#error) | Error if instance or organization was not found |
|
223
267
|
|
224
268
|
<br/>
|
225
269
|
|
@@ -264,4 +308,4 @@ all.Instance, all.Instance.read, all.User, all.User.read, instanceOrg.*, or inst
|
|
264
308
|
| Code | Type | Description |
|
265
309
|
| ---- | ---- | ----------- |
|
266
310
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
267
|
-
| 404 | [Error](_schemas.md#error) | Error if instance was not found |
|
311
|
+
| 404 | [Error](_schemas.md#error) | Error if instance or organization was not found |
|
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.27.
|
30
|
+
# Built For Version 1.27.2
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -406,7 +406,7 @@ module PlatformRest
|
|
406
406
|
|
407
407
|
headers["Accept"] = "application/json"
|
408
408
|
headers["Content-Type"] = "application/json"
|
409
|
-
headers["Accept-Version"] = "^1.27.
|
409
|
+
headers["Accept-Version"] = "^1.27.2"
|
410
410
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
411
411
|
path = self.url + options.fetch(:path, "")
|
412
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:
|