losant_rest 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/_schemas.md +210 -15
- data/docs/application.md +41 -0
- data/docs/dashboards.md +2 -1
- data/docs/dataTableRows.md +3 -2
- data/lib/losant_rest/application.rb +47 -0
- data/lib/losant_rest/client.rb +2 -2
- data/lib/losant_rest/dashboards.rb +3 -1
- data/lib/losant_rest/data_table_rows.rb +1 -0
- data/lib/losant_rest/version.rb +1 -1
- data/schemas/application.json +8 -0
- data/schemas/applicationApiTokenPost.json +1 -0
- data/schemas/applicationSearchResult.json +52 -0
- data/schemas/applications.json +8 -0
- data/schemas/dashboard.json +17 -0
- data/schemas/dashboardPost.json +4 -0
- data/schemas/dashboards.json +25 -0
- data/schemas/flow.json +2 -1
- data/schemas/flowPatch.json +2 -1
- data/schemas/flowPost.json +2 -1
- data/schemas/flowVersion.json +4 -2
- data/schemas/flowVersionPost.json +2 -1
- data/schemas/flowVersions.json +4 -2
- data/schemas/flows.json +2 -1
- data/schemas/flowsImportPost.json +4 -2
- data/schemas/flowsImportResult.json +6 -3
- data/schemas/githubLogin.json +2 -0
- data/schemas/timeSeriesData.json +1 -0
- data/schemas/timeSeriesQuery.json +1 -0
- data/schemas/userCredentials.json +2 -0
- data/schemas/userPost.json +2 -0
- data/schemas/virtualButtonPress.json +4 -0
- metadata +3 -2
data/docs/application.md
CHANGED
@@ -13,6 +13,7 @@ parameters and the potential responses.
|
|
13
13
|
* [Mqtt Publish Message](#mqtt-publish-message)
|
14
14
|
* [Patch](#patch)
|
15
15
|
* [Payload Counts](#payload-counts)
|
16
|
+
* [Search](#search)
|
16
17
|
|
17
18
|
<br/>
|
18
19
|
|
@@ -283,3 +284,43 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
283
284
|
| ---- | ---- | ----------- |
|
284
285
|
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
285
286
|
| 404 | [Error](_schemas.md#error) | Error if application was not found |
|
287
|
+
|
288
|
+
<br/>
|
289
|
+
|
290
|
+
## Search
|
291
|
+
|
292
|
+
Search across an application's resources by target identifier
|
293
|
+
|
294
|
+
```ruby
|
295
|
+
result = client.application.search(
|
296
|
+
applicationId: my_application_id,
|
297
|
+
filter: my_filter)
|
298
|
+
|
299
|
+
puts result
|
300
|
+
```
|
301
|
+
|
302
|
+
#### Authentication
|
303
|
+
The client must be configured with a valid api access token to call this
|
304
|
+
action. The token must include at least one of the following scopes:
|
305
|
+
all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.search.
|
306
|
+
|
307
|
+
#### Available Parameters
|
308
|
+
|
309
|
+
| Name | Type | Required | Description | Default | Example |
|
310
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
311
|
+
| applicationId | string | Y | ID of the associated application | | 575ec8687ae143cd83dc4a97 |
|
312
|
+
| filter | string | Y | The partial resource name being searched for | | my dev |
|
313
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
314
|
+
|
315
|
+
#### Successful Responses
|
316
|
+
|
317
|
+
| Code | Type | Description |
|
318
|
+
| ---- | ---- | ----------- |
|
319
|
+
| 200 | [Application Search Result](_schemas.md#application-search-result) | An array of resource ids, names, descriptions, and types matching the search query |
|
320
|
+
|
321
|
+
#### Error Responses
|
322
|
+
|
323
|
+
| Code | Type | Description |
|
324
|
+
| ---- | ---- | ----------- |
|
325
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
326
|
+
| 404 | [Error](_schemas.md#error) | Error if application is not found |
|
data/docs/dashboards.md
CHANGED
@@ -30,12 +30,13 @@ all.Organization, all.Organization.read, all.SolutionUser, all.SolutionUser.read
|
|
30
30
|
|
31
31
|
| Name | Type | Required | Description | Default | Example |
|
32
32
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
33
|
-
| sortField | string | N | Field to sort the results by. Accepted values are: name, id, creationDate, ownerId | name | name |
|
33
|
+
| sortField | string | N | Field to sort the results by. Accepted values are: name, id, creationDate, ownerId, applicationId | name | name |
|
34
34
|
| sortDirection | string | N | Direction to sort the results by. Accepted values are: asc, desc | asc | asc |
|
35
35
|
| page | string | N | Which page of results to return | 0 | 0 |
|
36
36
|
| perPage | string | N | How many items to return per page | 1000 | 10 |
|
37
37
|
| filterField | string | N | Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name | | name |
|
38
38
|
| filter | string | N | Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. | | my * dashboard |
|
39
|
+
| applicationId | string | N | If not provided, return all dashboards. If provided but blank, only return dashboards that are not linked to applications. If provided and an id, only return dashboards linked to the given application id. | | 575ec8687ae143cd83dc4a97 |
|
39
40
|
| orgId | string | N | If not provided, return all dashboards. If provided but blank, only return dashboards belonging to the current user. If provided and an id, only return dashboards belonging to the given organization id. | | 575ece7e7ae143cd83dc4a9c |
|
40
41
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
41
42
|
|
data/docs/dataTableRows.md
CHANGED
@@ -64,7 +64,8 @@ Request an export of the data table's data
|
|
64
64
|
```ruby
|
65
65
|
result = client.data_table_rows.export(
|
66
66
|
applicationId: my_application_id,
|
67
|
-
dataTableId: my_data_table_id
|
67
|
+
dataTableId: my_data_table_id,
|
68
|
+
exportData: my_export_data)
|
68
69
|
|
69
70
|
puts result
|
70
71
|
```
|
@@ -80,7 +81,7 @@ all.Application, all.Application.read, all.Organization, all.Organization.read,
|
|
80
81
|
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
81
82
|
| applicationId | string | Y | ID associated with the application | | 575ec8687ae143cd83dc4a97 |
|
82
83
|
| dataTableId | string | Y | ID associated with the data table | | 575ed78e7ae143cd83dc4aab |
|
83
|
-
| exportData | [Data Table Export](_schemas.md#data-table-export) |
|
84
|
+
| exportData | [Data Table Export](_schemas.md#data-table-export) | Y | Object containing export specifications | | [Data Table Export Example](_schemas.md#data-table-export-example) |
|
84
85
|
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
85
86
|
|
86
87
|
#### Successful Responses
|
@@ -350,5 +350,52 @@ module LosantRest
|
|
350
350
|
body: body)
|
351
351
|
end
|
352
352
|
|
353
|
+
# Search across an application's resources by target identifier
|
354
|
+
#
|
355
|
+
# Authentication:
|
356
|
+
# The client must be configured with a valid api
|
357
|
+
# access token to call this action. The token
|
358
|
+
# must include at least one of the following scopes:
|
359
|
+
# all.Application, all.Application.read, all.Organization, all.Organization.read, all.User, all.User.read, application.*, or application.search.
|
360
|
+
#
|
361
|
+
# Parameters:
|
362
|
+
# * {string} applicationId - ID of the associated application
|
363
|
+
# * {string} filter - The partial resource name being searched for
|
364
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
365
|
+
# * {boolean} _actions - Return resource actions in response
|
366
|
+
# * {boolean} _links - Return resource link in response
|
367
|
+
# * {boolean} _embedded - Return embedded resources in response
|
368
|
+
#
|
369
|
+
# Responses:
|
370
|
+
# * 200 - An array of resource ids, names, descriptions, and types matching the search query (https://api.losant.com/#/definitions/applicationSearchResult)
|
371
|
+
#
|
372
|
+
# Errors:
|
373
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
374
|
+
# * 404 - Error if application is not found (https://api.losant.com/#/definitions/error)
|
375
|
+
def search(params = {})
|
376
|
+
params = Utils.symbolize_hash_keys(params)
|
377
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
378
|
+
headers = {}
|
379
|
+
body = nil
|
380
|
+
|
381
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
382
|
+
raise ArgumentError.new("filter is required") unless params.has_key?(:filter)
|
383
|
+
|
384
|
+
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
385
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
386
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
387
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
388
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
389
|
+
|
390
|
+
path = "/applications/#{params[:applicationId]}/search"
|
391
|
+
|
392
|
+
@client.request(
|
393
|
+
method: :get,
|
394
|
+
path: path,
|
395
|
+
query: query_params,
|
396
|
+
headers: headers,
|
397
|
+
body: body)
|
398
|
+
end
|
399
|
+
|
353
400
|
end
|
354
401
|
end
|
data/lib/losant_rest/client.rb
CHANGED
@@ -27,7 +27,7 @@ module LosantRest
|
|
27
27
|
#
|
28
28
|
# User API for accessing Losant data
|
29
29
|
#
|
30
|
-
# Built For Version 1.13.
|
30
|
+
# Built For Version 1.13.3
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -266,7 +266,7 @@ module LosantRest
|
|
266
266
|
|
267
267
|
headers["Accept"] = "application/json"
|
268
268
|
headers["Content-Type"] = "application/json"
|
269
|
-
headers["Accept-Version"] = "^1.13.
|
269
|
+
headers["Accept-Version"] = "^1.13.3"
|
270
270
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
271
271
|
path = self.url + options.fetch(:path, "")
|
272
272
|
|
@@ -38,12 +38,13 @@ module LosantRest
|
|
38
38
|
# all.Organization, all.Organization.read, all.SolutionUser, all.SolutionUser.read, all.User, all.User.read, dashboards.*, or dashboards.get.
|
39
39
|
#
|
40
40
|
# Parameters:
|
41
|
-
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, ownerId
|
41
|
+
# * {string} sortField - Field to sort the results by. Accepted values are: name, id, creationDate, ownerId, applicationId
|
42
42
|
# * {string} sortDirection - Direction to sort the results by. Accepted values are: asc, desc
|
43
43
|
# * {string} page - Which page of results to return
|
44
44
|
# * {string} perPage - How many items to return per page
|
45
45
|
# * {string} filterField - Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name
|
46
46
|
# * {string} filter - Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.
|
47
|
+
# * {string} applicationId - If not provided, return all dashboards. If provided but blank, only return dashboards that are not linked to applications. If provided and an id, only return dashboards linked to the given application id.
|
47
48
|
# * {string} orgId - If not provided, return all dashboards. If provided but blank, only return dashboards belonging to the current user. If provided and an id, only return dashboards belonging to the given organization id.
|
48
49
|
# * {string} losantdomain - Domain scope of request (rarely needed)
|
49
50
|
# * {boolean} _actions - Return resource actions in response
|
@@ -68,6 +69,7 @@ module LosantRest
|
|
68
69
|
query_params[:perPage] = params[:perPage] if params.has_key?(:perPage)
|
69
70
|
query_params[:filterField] = params[:filterField] if params.has_key?(:filterField)
|
70
71
|
query_params[:filter] = params[:filter] if params.has_key?(:filter)
|
72
|
+
query_params[:applicationId] = params[:applicationId] if params.has_key?(:applicationId)
|
71
73
|
query_params[:orgId] = params[:orgId] if params.has_key?(:orgId)
|
72
74
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
73
75
|
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
@@ -110,6 +110,7 @@ module LosantRest
|
|
110
110
|
|
111
111
|
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
112
112
|
raise ArgumentError.new("dataTableId is required") unless params.has_key?(:dataTableId)
|
113
|
+
raise ArgumentError.new("exportData is required") unless params.has_key?(:exportData)
|
113
114
|
|
114
115
|
body = params[:exportData] if params.has_key?(:exportData)
|
115
116
|
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
data/lib/losant_rest/version.rb
CHANGED
data/schemas/application.json
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"type": "array",
|
4
|
+
"items": {
|
5
|
+
"type": "object",
|
6
|
+
"properties": {
|
7
|
+
"id": {
|
8
|
+
"type": "string",
|
9
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
10
|
+
},
|
11
|
+
"name": {
|
12
|
+
"type": "string"
|
13
|
+
},
|
14
|
+
"metadata": {
|
15
|
+
"type": "object"
|
16
|
+
},
|
17
|
+
"viewType": {
|
18
|
+
"type": "string"
|
19
|
+
},
|
20
|
+
"version": {
|
21
|
+
"type": "string"
|
22
|
+
},
|
23
|
+
"_type": {
|
24
|
+
"type": "string",
|
25
|
+
"enum": [
|
26
|
+
"applicationKey",
|
27
|
+
"dashboard",
|
28
|
+
"dataTable",
|
29
|
+
"deviceRecipe",
|
30
|
+
"device",
|
31
|
+
"domain",
|
32
|
+
"event",
|
33
|
+
"experienceEndpoint",
|
34
|
+
"experienceGroup",
|
35
|
+
"experienceSlug",
|
36
|
+
"experienceUser",
|
37
|
+
"experienceVersion",
|
38
|
+
"experienceView",
|
39
|
+
"file",
|
40
|
+
"flow",
|
41
|
+
"integration",
|
42
|
+
"webhook"
|
43
|
+
]
|
44
|
+
}
|
45
|
+
},
|
46
|
+
"required": [
|
47
|
+
"id",
|
48
|
+
"name",
|
49
|
+
"_type"
|
50
|
+
]
|
51
|
+
}
|
52
|
+
}
|
data/schemas/applications.json
CHANGED
data/schemas/dashboard.json
CHANGED
@@ -29,6 +29,23 @@
|
|
29
29
|
"organization"
|
30
30
|
]
|
31
31
|
},
|
32
|
+
"organizationName": {
|
33
|
+
"type": "string",
|
34
|
+
"minLength": 1,
|
35
|
+
"maxLength": 255
|
36
|
+
},
|
37
|
+
"organizationIconColor": {
|
38
|
+
"type": "string"
|
39
|
+
},
|
40
|
+
"applicationId": {
|
41
|
+
"type": "string",
|
42
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
43
|
+
},
|
44
|
+
"applicationName": {
|
45
|
+
"type": "string",
|
46
|
+
"minLength": 1,
|
47
|
+
"maxLength": 255
|
48
|
+
},
|
32
49
|
"name": {
|
33
50
|
"type": "string",
|
34
51
|
"minLength": 1,
|
data/schemas/dashboardPost.json
CHANGED
data/schemas/dashboards.json
CHANGED
@@ -36,6 +36,23 @@
|
|
36
36
|
"organization"
|
37
37
|
]
|
38
38
|
},
|
39
|
+
"organizationName": {
|
40
|
+
"type": "string",
|
41
|
+
"minLength": 1,
|
42
|
+
"maxLength": 255
|
43
|
+
},
|
44
|
+
"organizationIconColor": {
|
45
|
+
"type": "string"
|
46
|
+
},
|
47
|
+
"applicationId": {
|
48
|
+
"type": "string",
|
49
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
50
|
+
},
|
51
|
+
"applicationName": {
|
52
|
+
"type": "string",
|
53
|
+
"minLength": 1,
|
54
|
+
"maxLength": 255
|
55
|
+
},
|
39
56
|
"name": {
|
40
57
|
"type": "string",
|
41
58
|
"minLength": 1,
|
@@ -331,6 +348,14 @@
|
|
331
348
|
"asc",
|
332
349
|
"desc"
|
333
350
|
]
|
351
|
+
},
|
352
|
+
"orgId": {
|
353
|
+
"type": "string",
|
354
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
355
|
+
},
|
356
|
+
"applicationId": {
|
357
|
+
"type": "string",
|
358
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
334
359
|
}
|
335
360
|
}
|
336
361
|
}
|
data/schemas/flow.json
CHANGED
@@ -68,6 +68,7 @@
|
|
68
68
|
"type": {
|
69
69
|
"type": "string",
|
70
70
|
"enum": [
|
71
|
+
"customNodeStart",
|
71
72
|
"dataTable",
|
72
73
|
"deviceCommand",
|
73
74
|
"deviceId",
|
@@ -83,8 +84,8 @@
|
|
83
84
|
"fileWatch",
|
84
85
|
"integration",
|
85
86
|
"mqttTopic",
|
87
|
+
"redis",
|
86
88
|
"request",
|
87
|
-
"customNodeStart",
|
88
89
|
"timer",
|
89
90
|
"udp",
|
90
91
|
"virtualButton",
|
data/schemas/flowPatch.json
CHANGED
@@ -49,6 +49,7 @@
|
|
49
49
|
"type": {
|
50
50
|
"type": "string",
|
51
51
|
"enum": [
|
52
|
+
"customNodeStart",
|
52
53
|
"dataTable",
|
53
54
|
"deviceCommand",
|
54
55
|
"deviceId",
|
@@ -64,8 +65,8 @@
|
|
64
65
|
"fileWatch",
|
65
66
|
"integration",
|
66
67
|
"mqttTopic",
|
68
|
+
"redis",
|
67
69
|
"request",
|
68
|
-
"customNodeStart",
|
69
70
|
"timer",
|
70
71
|
"udp",
|
71
72
|
"virtualButton",
|
data/schemas/flowPost.json
CHANGED
@@ -38,6 +38,7 @@
|
|
38
38
|
"type": {
|
39
39
|
"type": "string",
|
40
40
|
"enum": [
|
41
|
+
"customNodeStart",
|
41
42
|
"dataTable",
|
42
43
|
"deviceCommand",
|
43
44
|
"deviceId",
|
@@ -53,8 +54,8 @@
|
|
53
54
|
"fileWatch",
|
54
55
|
"integration",
|
55
56
|
"mqttTopic",
|
57
|
+
"redis",
|
56
58
|
"request",
|
57
|
-
"customNodeStart",
|
58
59
|
"timer",
|
59
60
|
"udp",
|
60
61
|
"virtualButton",
|
data/schemas/flowVersion.json
CHANGED
@@ -53,6 +53,7 @@
|
|
53
53
|
"type": {
|
54
54
|
"type": "string",
|
55
55
|
"enum": [
|
56
|
+
"customNodeStart",
|
56
57
|
"dataTable",
|
57
58
|
"deviceCommand",
|
58
59
|
"deviceId",
|
@@ -68,8 +69,8 @@
|
|
68
69
|
"fileWatch",
|
69
70
|
"integration",
|
70
71
|
"mqttTopic",
|
72
|
+
"redis",
|
71
73
|
"request",
|
72
|
-
"customNodeStart",
|
73
74
|
"timer",
|
74
75
|
"udp",
|
75
76
|
"virtualButton",
|
@@ -581,6 +582,7 @@
|
|
581
582
|
"type": {
|
582
583
|
"type": "string",
|
583
584
|
"enum": [
|
585
|
+
"customNodeStart",
|
584
586
|
"dataTable",
|
585
587
|
"deviceCommand",
|
586
588
|
"deviceId",
|
@@ -596,8 +598,8 @@
|
|
596
598
|
"fileWatch",
|
597
599
|
"integration",
|
598
600
|
"mqttTopic",
|
601
|
+
"redis",
|
599
602
|
"request",
|
600
|
-
"customNodeStart",
|
601
603
|
"timer",
|
602
604
|
"udp",
|
603
605
|
"virtualButton",
|