losant_rest 1.9.0 → 1.9.1
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 +3306 -1245
- data/docs/application.md +42 -0
- data/lib/losant_rest/application.rb +49 -0
- data/lib/losant_rest/client.rb +2 -2
- data/lib/losant_rest/version.rb +1 -1
- data/schemas/application.json +4 -0
- data/schemas/applicationApiTokenPost.json +1 -0
- data/schemas/applicationCloneDryRunResult.json +15 -0
- data/schemas/applicationCloneEnqueued.json +9 -0
- data/schemas/applicationClonePost.json +46 -0
- data/schemas/applicationCloneResult.json +372 -0
- data/schemas/applicationPatch.json +4 -0
- data/schemas/applicationPost.json +4 -0
- data/schemas/applications.json +4 -0
- data/schemas/dashboard.json +9 -0
- data/schemas/dashboardPatch.json +9 -0
- data/schemas/dashboardPost.json +9 -0
- data/schemas/dashboards.json +9 -0
- data/schemas/flow.json +91 -0
- data/schemas/flowPatch.json +91 -0
- data/schemas/flowPost.json +91 -0
- data/schemas/flowVersion.json +182 -0
- data/schemas/flowVersionPost.json +91 -0
- data/schemas/flowVersions.json +182 -0
- data/schemas/flows.json +91 -0
- data/schemas/flowsImportPost.json +182 -0
- data/schemas/flowsImportResult.json +273 -0
- data/schemas/githubLogin.json +1 -0
- data/schemas/notebook.json +26 -0
- data/schemas/notebookPatch.json +26 -0
- data/schemas/notebookPost.json +26 -0
- data/schemas/notebooks.json +26 -0
- data/schemas/userCredentials.json +1 -0
- data/schemas/userPost.json +1 -0
- data/schemas/validationCloneErrors.json +33 -0
- metadata +7 -2
data/docs/application.md
CHANGED
@@ -8,6 +8,7 @@ parameters and the potential responses.
|
|
8
8
|
|
9
9
|
* [Archive Data](#archive-data)
|
10
10
|
* [Backfill Archive Data](#backfill-archive-data)
|
11
|
+
* [Clone](#clone)
|
11
12
|
* [Delete](#delete)
|
12
13
|
* [Full Data Tables Archive](#full-data-tables-archive)
|
13
14
|
* [Full Events Archive](#full-events-archive)
|
@@ -96,6 +97,47 @@ all.Application, all.Organization, all.User, application.*, or application.backf
|
|
96
97
|
|
97
98
|
<br/>
|
98
99
|
|
100
|
+
## Clone
|
101
|
+
|
102
|
+
Copy an application into a new application
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
result = client.application.clone(applicationId: my_application_id)
|
106
|
+
|
107
|
+
puts result
|
108
|
+
```
|
109
|
+
|
110
|
+
#### Authentication
|
111
|
+
The client must be configured with a valid api access token to call this
|
112
|
+
action. The token must include at least one of the following scopes:
|
113
|
+
all.Application, all.Organization, all.User, application.*, or application.clone.
|
114
|
+
|
115
|
+
#### Available Parameters
|
116
|
+
|
117
|
+
| Name | Type | Required | Description | Default | Example |
|
118
|
+
| ---- | ---- | -------- | ----------- | ------- | ------- |
|
119
|
+
| applicationId | string | Y | ID of the associated application | | 575ec8687ae143cd83dc4a97 |
|
120
|
+
| options | [Application Clone Post Schema](_schemas.md#application-clone-post-schema) | N | Object containing optional clone fields | | [Application Clone Post Schema Example](_schemas.md#application-clone-post-schema-example) |
|
121
|
+
| losantdomain | string | N | Domain scope of request (rarely needed) | | example.com |
|
122
|
+
|
123
|
+
#### Successful Responses
|
124
|
+
|
125
|
+
| Code | Type | Description |
|
126
|
+
| ---- | ---- | ----------- |
|
127
|
+
| 200 | [Success Dry Run](_schemas.md#success-dry-run) | if dryRun is set and successful, then return success |
|
128
|
+
| 201 | [Application Clone](_schemas.md#application-clone) | If application was successfully cloned |
|
129
|
+
| 202 | [Application Clone Enqueue](_schemas.md#application-clone-enqueue) | If application was enqueued to be cloned |
|
130
|
+
|
131
|
+
#### Error Responses
|
132
|
+
|
133
|
+
| Code | Type | Description |
|
134
|
+
| ---- | ---- | ----------- |
|
135
|
+
| 400 | [Error](_schemas.md#error) | Error if malformed request |
|
136
|
+
| 404 | [Error](_schemas.md#error) | Error if application is not found |
|
137
|
+
| 422 | [Validation Clone Error](_schemas.md#validation-clone-error) | Error if too many validation errors occurred on other resources |
|
138
|
+
|
139
|
+
<br/>
|
140
|
+
|
99
141
|
## Delete
|
100
142
|
|
101
143
|
Deletes an application
|
@@ -122,6 +122,55 @@ module LosantRest
|
|
122
122
|
body: body)
|
123
123
|
end
|
124
124
|
|
125
|
+
# Copy an application into a new application
|
126
|
+
#
|
127
|
+
# Authentication:
|
128
|
+
# The client must be configured with a valid api
|
129
|
+
# access token to call this action. The token
|
130
|
+
# must include at least one of the following scopes:
|
131
|
+
# all.Application, all.Organization, all.User, application.*, or application.clone.
|
132
|
+
#
|
133
|
+
# Parameters:
|
134
|
+
# * {string} applicationId - ID of the associated application
|
135
|
+
# * {hash} options - Object containing optional clone fields (https://api.losant.com/#/definitions/applicationClonePost)
|
136
|
+
# * {string} losantdomain - Domain scope of request (rarely needed)
|
137
|
+
# * {boolean} _actions - Return resource actions in response
|
138
|
+
# * {boolean} _links - Return resource link in response
|
139
|
+
# * {boolean} _embedded - Return embedded resources in response
|
140
|
+
#
|
141
|
+
# Responses:
|
142
|
+
# * 200 - if dryRun is set and successful, then return success (https://api.losant.com/#/definitions/applicationCloneDryRunResult)
|
143
|
+
# * 201 - If application was successfully cloned (https://api.losant.com/#/definitions/applicationCloneResult)
|
144
|
+
# * 202 - If application was enqueued to be cloned (https://api.losant.com/#/definitions/applicationCloneEnqueued)
|
145
|
+
#
|
146
|
+
# Errors:
|
147
|
+
# * 400 - Error if malformed request (https://api.losant.com/#/definitions/error)
|
148
|
+
# * 404 - Error if application is not found (https://api.losant.com/#/definitions/error)
|
149
|
+
# * 422 - Error if too many validation errors occurred on other resources (https://api.losant.com/#/definitions/validationCloneErrors)
|
150
|
+
def clone(params = {})
|
151
|
+
params = Utils.symbolize_hash_keys(params)
|
152
|
+
query_params = { _actions: false, _links: true, _embedded: true }
|
153
|
+
headers = {}
|
154
|
+
body = nil
|
155
|
+
|
156
|
+
raise ArgumentError.new("applicationId is required") unless params.has_key?(:applicationId)
|
157
|
+
|
158
|
+
body = params[:options] if params.has_key?(:options)
|
159
|
+
headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
|
160
|
+
query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
|
161
|
+
query_params[:_links] = params[:_links] if params.has_key?(:_links)
|
162
|
+
query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)
|
163
|
+
|
164
|
+
path = "/applications/#{params[:applicationId]}/clone"
|
165
|
+
|
166
|
+
@client.request(
|
167
|
+
method: :post,
|
168
|
+
path: path,
|
169
|
+
query: query_params,
|
170
|
+
headers: headers,
|
171
|
+
body: body)
|
172
|
+
end
|
173
|
+
|
125
174
|
# Deletes an application
|
126
175
|
#
|
127
176
|
# Authentication:
|
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.16.
|
30
|
+
# Built For Version 1.16.1
|
31
31
|
class Client
|
32
32
|
attr_accessor :auth_token, :url
|
33
33
|
|
@@ -274,7 +274,7 @@ module LosantRest
|
|
274
274
|
|
275
275
|
headers["Accept"] = "application/json"
|
276
276
|
headers["Content-Type"] = "application/json"
|
277
|
-
headers["Accept-Version"] = "^1.16.
|
277
|
+
headers["Accept-Version"] = "^1.16.1"
|
278
278
|
headers["Authorization"] = "Bearer #{self.auth_token}" if self.auth_token
|
279
279
|
path = self.url + options.fetch(:path, "")
|
280
280
|
|
data/lib/losant_rest/version.rb
CHANGED
data/schemas/application.json
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"type": "object",
|
4
|
+
"properties": {
|
5
|
+
"dryRun": {
|
6
|
+
"type": "boolean",
|
7
|
+
"default": false
|
8
|
+
},
|
9
|
+
"includeFiles": {
|
10
|
+
"type": "boolean",
|
11
|
+
"default": false
|
12
|
+
},
|
13
|
+
"includeDataTableRows": {
|
14
|
+
"type": "boolean",
|
15
|
+
"default": false
|
16
|
+
},
|
17
|
+
"includeDevices": {
|
18
|
+
"type": "boolean",
|
19
|
+
"default": false
|
20
|
+
},
|
21
|
+
"ownerId": {
|
22
|
+
"oneOf": [
|
23
|
+
{
|
24
|
+
"type": "string",
|
25
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"type": "null"
|
29
|
+
}
|
30
|
+
]
|
31
|
+
},
|
32
|
+
"ownerType": {
|
33
|
+
"type": "string",
|
34
|
+
"enum": [
|
35
|
+
"user",
|
36
|
+
"organization"
|
37
|
+
]
|
38
|
+
},
|
39
|
+
"email": {
|
40
|
+
"type": "string",
|
41
|
+
"format": "email",
|
42
|
+
"maxLength": 1024
|
43
|
+
}
|
44
|
+
},
|
45
|
+
"additionalProperties": false
|
46
|
+
}
|
@@ -0,0 +1,372 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema#",
|
3
|
+
"type": "object",
|
4
|
+
"properties": {
|
5
|
+
"application": {
|
6
|
+
"title": "Application",
|
7
|
+
"description": "Schema for a single Application",
|
8
|
+
"type": "object",
|
9
|
+
"properties": {
|
10
|
+
"id": {
|
11
|
+
"type": "string",
|
12
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
13
|
+
},
|
14
|
+
"applicationId": {
|
15
|
+
"type": "string",
|
16
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
17
|
+
},
|
18
|
+
"creationDate": {
|
19
|
+
"type": "string",
|
20
|
+
"format": "date-time"
|
21
|
+
},
|
22
|
+
"lastUpdated": {
|
23
|
+
"type": "string",
|
24
|
+
"format": "date-time"
|
25
|
+
},
|
26
|
+
"ownerId": {
|
27
|
+
"type": "string",
|
28
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
29
|
+
},
|
30
|
+
"ownerType": {
|
31
|
+
"type": "string",
|
32
|
+
"enum": [
|
33
|
+
"user",
|
34
|
+
"organization"
|
35
|
+
]
|
36
|
+
},
|
37
|
+
"organizationName": {
|
38
|
+
"type": "string",
|
39
|
+
"minLength": 1,
|
40
|
+
"maxLength": 255
|
41
|
+
},
|
42
|
+
"organizationIconColor": {
|
43
|
+
"type": "string",
|
44
|
+
"maxLength": 64
|
45
|
+
},
|
46
|
+
"name": {
|
47
|
+
"type": "string",
|
48
|
+
"minLength": 1,
|
49
|
+
"maxLength": 255
|
50
|
+
},
|
51
|
+
"description": {
|
52
|
+
"type": "string",
|
53
|
+
"maxLength": 32767
|
54
|
+
},
|
55
|
+
"endpointSlug": {
|
56
|
+
"type": "string",
|
57
|
+
"minLength": 4,
|
58
|
+
"maxLength": 63,
|
59
|
+
"pattern": "^[0-9a-z-]*$"
|
60
|
+
},
|
61
|
+
"expUserTokenCutoff": {
|
62
|
+
"type": "string",
|
63
|
+
"format": "date-time"
|
64
|
+
},
|
65
|
+
"endpointDefaultCors": {
|
66
|
+
"type": "boolean"
|
67
|
+
},
|
68
|
+
"globals": {
|
69
|
+
"type": "array",
|
70
|
+
"maxItems": 100,
|
71
|
+
"items": {
|
72
|
+
"type": "object",
|
73
|
+
"properties": {
|
74
|
+
"key": {
|
75
|
+
"type": "string",
|
76
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
77
|
+
},
|
78
|
+
"json": {
|
79
|
+
"type": "string",
|
80
|
+
"minLength": 1,
|
81
|
+
"maxLength": 32767
|
82
|
+
},
|
83
|
+
"cloudOnly": {
|
84
|
+
"type": "boolean",
|
85
|
+
"default": false
|
86
|
+
},
|
87
|
+
"description": {
|
88
|
+
"type": "string",
|
89
|
+
"maxLength": 32767
|
90
|
+
}
|
91
|
+
},
|
92
|
+
"additionalProperties": false,
|
93
|
+
"required": [
|
94
|
+
"key",
|
95
|
+
"json"
|
96
|
+
]
|
97
|
+
}
|
98
|
+
},
|
99
|
+
"summary": {
|
100
|
+
"type": "object",
|
101
|
+
"properties": {
|
102
|
+
"apiTokenCount": {
|
103
|
+
"type": "number"
|
104
|
+
},
|
105
|
+
"dataTableCount": {
|
106
|
+
"type": "number"
|
107
|
+
},
|
108
|
+
"deviceCount": {
|
109
|
+
"type": "number"
|
110
|
+
},
|
111
|
+
"deviceRecipeCount": {
|
112
|
+
"type": "number"
|
113
|
+
},
|
114
|
+
"eventCount": {
|
115
|
+
"type": "number"
|
116
|
+
},
|
117
|
+
"experienceDomainCount": {
|
118
|
+
"type": "number"
|
119
|
+
},
|
120
|
+
"experienceEndpointCount": {
|
121
|
+
"type": "number"
|
122
|
+
},
|
123
|
+
"experienceGroupCount": {
|
124
|
+
"type": "number"
|
125
|
+
},
|
126
|
+
"experienceSlugCount": {
|
127
|
+
"type": "number"
|
128
|
+
},
|
129
|
+
"experienceUserCount": {
|
130
|
+
"type": "number"
|
131
|
+
},
|
132
|
+
"experienceVersionCount": {
|
133
|
+
"type": "number"
|
134
|
+
},
|
135
|
+
"experienceViewCount": {
|
136
|
+
"type": "number"
|
137
|
+
},
|
138
|
+
"fileCount": {
|
139
|
+
"type": "number"
|
140
|
+
},
|
141
|
+
"flowCount": {
|
142
|
+
"type": "number"
|
143
|
+
},
|
144
|
+
"integrationCount": {
|
145
|
+
"type": "number"
|
146
|
+
},
|
147
|
+
"keyCount": {
|
148
|
+
"type": "number"
|
149
|
+
},
|
150
|
+
"storageStats": {
|
151
|
+
"type": "object",
|
152
|
+
"properties": {
|
153
|
+
"count": {
|
154
|
+
"type": "number"
|
155
|
+
},
|
156
|
+
"size": {
|
157
|
+
"type": "number"
|
158
|
+
}
|
159
|
+
}
|
160
|
+
},
|
161
|
+
"webhookCount": {
|
162
|
+
"type": "number"
|
163
|
+
}
|
164
|
+
}
|
165
|
+
},
|
166
|
+
"ftueTracking": {
|
167
|
+
"type": "array",
|
168
|
+
"items": {
|
169
|
+
"type": "object",
|
170
|
+
"properties": {
|
171
|
+
"name": {
|
172
|
+
"type": "string",
|
173
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
174
|
+
},
|
175
|
+
"version": {
|
176
|
+
"type": "number"
|
177
|
+
},
|
178
|
+
"status": {
|
179
|
+
"type": "string",
|
180
|
+
"enum": [
|
181
|
+
"skipped",
|
182
|
+
"completed"
|
183
|
+
]
|
184
|
+
}
|
185
|
+
},
|
186
|
+
"required": [
|
187
|
+
"name",
|
188
|
+
"version",
|
189
|
+
"status"
|
190
|
+
],
|
191
|
+
"additionalProperties": false
|
192
|
+
},
|
193
|
+
"maxItems": 100
|
194
|
+
},
|
195
|
+
"archiveConfig": {
|
196
|
+
"type": "object",
|
197
|
+
"properties": {
|
198
|
+
"directory": {
|
199
|
+
"type": "string",
|
200
|
+
"max": 255
|
201
|
+
},
|
202
|
+
"mode": {
|
203
|
+
"type": "string",
|
204
|
+
"enum": [
|
205
|
+
"all",
|
206
|
+
"whitelist",
|
207
|
+
"blacklist"
|
208
|
+
]
|
209
|
+
},
|
210
|
+
"deviceIds": {
|
211
|
+
"type": "array",
|
212
|
+
"items": {
|
213
|
+
"type": "string",
|
214
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
215
|
+
},
|
216
|
+
"maxItems": 1000
|
217
|
+
},
|
218
|
+
"deviceTags": {
|
219
|
+
"type": "array",
|
220
|
+
"items": {
|
221
|
+
"type": "object",
|
222
|
+
"properties": {
|
223
|
+
"key": {
|
224
|
+
"type": "string",
|
225
|
+
"pattern": "^[0-9a-zA-Z_-]{1,255}$"
|
226
|
+
},
|
227
|
+
"value": {
|
228
|
+
"type": "string",
|
229
|
+
"minLength": 1,
|
230
|
+
"maxLength": 255
|
231
|
+
}
|
232
|
+
},
|
233
|
+
"additionalProperties": false
|
234
|
+
},
|
235
|
+
"maxItems": 100
|
236
|
+
},
|
237
|
+
"includeDevices": {
|
238
|
+
"type": "boolean",
|
239
|
+
"default": true
|
240
|
+
},
|
241
|
+
"includeEvents": {
|
242
|
+
"type": "boolean",
|
243
|
+
"default": false
|
244
|
+
},
|
245
|
+
"includeDataTables": {
|
246
|
+
"type": "boolean",
|
247
|
+
"default": false
|
248
|
+
},
|
249
|
+
"dataTablesMode": {
|
250
|
+
"type": "string",
|
251
|
+
"enum": [
|
252
|
+
"all",
|
253
|
+
"whitelist",
|
254
|
+
"blacklist"
|
255
|
+
]
|
256
|
+
},
|
257
|
+
"dataTableIds": {
|
258
|
+
"type": "array",
|
259
|
+
"items": {
|
260
|
+
"type": "string",
|
261
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
262
|
+
},
|
263
|
+
"maxItems": 1000
|
264
|
+
},
|
265
|
+
"s3": {
|
266
|
+
"type": "object",
|
267
|
+
"properties": {
|
268
|
+
"bucket": {
|
269
|
+
"type": "string",
|
270
|
+
"max": 255
|
271
|
+
},
|
272
|
+
"accessKeyId": {
|
273
|
+
"type": "string",
|
274
|
+
"min": 16,
|
275
|
+
"max": 128
|
276
|
+
},
|
277
|
+
"secretAccessKey": {
|
278
|
+
"type": "string",
|
279
|
+
"min": 16,
|
280
|
+
"max": 128
|
281
|
+
},
|
282
|
+
"region": {
|
283
|
+
"type": "string",
|
284
|
+
"max": 128
|
285
|
+
}
|
286
|
+
},
|
287
|
+
"required": [
|
288
|
+
"bucket",
|
289
|
+
"accessKeyId",
|
290
|
+
"secretAccessKey",
|
291
|
+
"region"
|
292
|
+
],
|
293
|
+
"additionalProperties": false
|
294
|
+
},
|
295
|
+
"gcs": {
|
296
|
+
"type": "object",
|
297
|
+
"properties": {
|
298
|
+
"projectId": {
|
299
|
+
"type": "string",
|
300
|
+
"minLength": 1,
|
301
|
+
"maxLength": 1024
|
302
|
+
},
|
303
|
+
"keyJson": {
|
304
|
+
"type": "string",
|
305
|
+
"maxLength": 32767,
|
306
|
+
"minLength": 50
|
307
|
+
},
|
308
|
+
"bucket": {
|
309
|
+
"type": "string",
|
310
|
+
"max": 255
|
311
|
+
}
|
312
|
+
},
|
313
|
+
"required": [
|
314
|
+
"projectId",
|
315
|
+
"keyJson",
|
316
|
+
"bucket"
|
317
|
+
],
|
318
|
+
"additionalProperties": false
|
319
|
+
},
|
320
|
+
"azure": {
|
321
|
+
"type": "object",
|
322
|
+
"properties": {
|
323
|
+
"account": {
|
324
|
+
"type": "string",
|
325
|
+
"min": 3,
|
326
|
+
"max": 24
|
327
|
+
},
|
328
|
+
"accountKey": {
|
329
|
+
"type": "string",
|
330
|
+
"max": 255
|
331
|
+
},
|
332
|
+
"bucket": {
|
333
|
+
"type": "string",
|
334
|
+
"min": 3,
|
335
|
+
"max": 63
|
336
|
+
}
|
337
|
+
},
|
338
|
+
"required": [
|
339
|
+
"account",
|
340
|
+
"accountKey",
|
341
|
+
"bucket"
|
342
|
+
],
|
343
|
+
"additionalProperties": false
|
344
|
+
}
|
345
|
+
},
|
346
|
+
"additionalProperties": false
|
347
|
+
}
|
348
|
+
}
|
349
|
+
},
|
350
|
+
"validationErrors": {
|
351
|
+
"type": "array",
|
352
|
+
"items": {
|
353
|
+
"type": "object",
|
354
|
+
"properties": {
|
355
|
+
"type": {
|
356
|
+
"type": "string"
|
357
|
+
},
|
358
|
+
"name": {
|
359
|
+
"type": "string"
|
360
|
+
},
|
361
|
+
"id": {
|
362
|
+
"type": "string",
|
363
|
+
"pattern": "^[A-Fa-f\\d]{24}$"
|
364
|
+
},
|
365
|
+
"message": {
|
366
|
+
"type": "string"
|
367
|
+
}
|
368
|
+
}
|
369
|
+
}
|
370
|
+
}
|
371
|
+
}
|
372
|
+
}
|
data/schemas/applications.json
CHANGED
data/schemas/dashboard.json
CHANGED
data/schemas/dashboardPatch.json
CHANGED