You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CommandsManual.md
+14-10
Original file line number
Diff line number
Diff line change
@@ -123,7 +123,7 @@ Applicable to the following impCentral API entities — Account, Product, De
123
123
- If at least one entity is found for the particular attribute, the search is stopped.
124
124
- If no entity is found for all attributes, or more than one entity is found, then, depending on a particular command, that may be considered as a success (for all `list` commands) or as a fail (for all other commands).
125
125
126
-
### Account identifier ###
126
+
### Account Identifier ###
127
127
128
128
Option: `--owner <ACCOUNT_IDENTIFIER>`
129
129
@@ -134,7 +134,7 @@ Attributes accepted as <ACCOUNT_IDENTIFIER> (in order of search):
134
134
- Email (always unique)
135
135
- Username (always unique)
136
136
137
-
### Product identifier ###
137
+
### Product Identifier ###
138
138
139
139
Option: `--product <PRODUCT_IDENTIFIER>`
140
140
@@ -143,7 +143,7 @@ Attributes accepted as `<PRODUCT_IDENTIFIER>` (in order of search):
143
143
- Product ID (always unique)
144
144
- Product name (unique among all Products owned by a particular user)
145
145
146
-
### Device Group identifier ###
146
+
### Device Group Identifier ###
147
147
148
148
Option: `--dg <DEVICE_GROUP_IDENTIFIER>`
149
149
@@ -152,7 +152,7 @@ Attributes accepted as `<DEVICE_GROUP_IDENTIFIER>` (in order of search):
152
152
- Device Group ID (always unique)
153
153
- Device Group name (unique among all the Device Groups within a Product)
154
154
155
-
### Device identifier ###
155
+
### Device Identifier ###
156
156
157
157
Option: `--device <DEVICE_IDENTIFIER>`
158
158
@@ -163,7 +163,7 @@ Attributes accepted as `<DEVICE_IDENTIFIER>` (in order of search):
163
163
- Agent ID
164
164
- Device name
165
165
166
-
### Build identifier ###
166
+
### Build Identifier ###
167
167
168
168
Option: `--build <BUILD_IDENTIFIER>`
169
169
@@ -237,25 +237,29 @@ Displays the status and the details of the authentication applicable to the curr
Perform global or local login. Creates a [global](#global-auth-file) or [local](#local-auth-file) auth file.
245
245
246
-
The options for one and only one of the following authentication methods must be specified in the command:
246
+
The options for one, and only one, of the following authentication methods may be specified in the command:
247
247
- Using an account identifier and password (`--user` and `--pwd` options).
248
248
- Using a [login key](#login-key-manipulation-commands) (`--lk` option).
249
249
250
+
If neither the `--user` nor the `--lk` option is specified, the user is asked to choose an authentication method and input the corresponding credentials.
251
+
252
+
If the `--user` option is specified but the `--pwd` option is not, the user is asked to input the account password.
253
+
250
254
The user is asked to confirm the operation if the corresponding auth file already exists, unless confirmed automatically with the `--confirmed` option. If confirmed, the existing auth file is overwritten.
251
255
252
256
| Option | Alias | Mandatory? | Value Required? | Description |
253
257
| --- | --- | --- | --- | --- |
254
258
| --local | -l | No | No | If specified, creates or replaces a [local auth file](#local-auth-file) in the current directory. If not specified, creates or replaces the [global auth file](#global-auth-file)|
255
259
| --endpoint | -e | No | Yes | An impCentral API endpoint. Default: `https://api.electricimp.com/v5`|
256
-
| --user | -u |Yes/no| Yes | The account identifier: username or email address. If specified, the `--pwd` option must be specified too|
257
-
| --pwd | -w |Yes/no| Yes | The account password. If specified, the `--user` option must be specified too |
258
-
| --lk | -k |Yes/no| Yes |The login key ID|
260
+
| --user | -u |No| Yes | The account identifier: a username or an email address |
261
+
| --pwd | -w |No| Yes | The account password. If specified, the `--user` option must be specified too |
262
+
| --lk | -k |No| Yes |A login key for the account|
259
263
| --temp | -t | No | No | If this option is not specified, *impt* saves the information required to refresh access token and refreshes it automatically when the token expires. If the option is specified, the tool does not save information required to refresh access token. In this case, you need to call `impt auth login` again after the access token has expired |
260
264
| --confirmed | -q | No | No | Executes the operation without asking additional confirmation from user |
261
265
| --debug | -z | No | No | Displays debug info for the command execution |
All commands follow a unified format and [syntax](./CommandsManual.md#command-syntax):
58
58
59
-
```
59
+
```bash
60
60
impt <command_group><command_name> [<options>]
61
61
```
62
62
@@ -87,21 +87,21 @@ The most of commands have optional arguments: `--<options>`. Options may be writ
87
87
88
88
Every option has a one letter [alias](./CommandsManual.md#list-of-aliases). The aliases are unique for a particular command but may be reused for different options in different commands. The same option in different commands always has the same alias. The options and aliases are detailed in the [Command Description](./CommandsManual.md#command-description).
89
89
90
-
**Examples**
90
+
##### Examples #####
91
91
92
-
```
92
+
```bash
93
93
impt product create --name TestProduct --descr "My test product"
94
94
```
95
95
96
-
```
96
+
```bash
97
97
impt product update --product TestProduct -s ""
98
98
```
99
99
100
-
```
100
+
```bash
101
101
impt dg create --name "TestDG" -y development -p TestProduct
102
102
```
103
103
104
-
```
104
+
```bash
105
105
impt device assign -g TestDG -d myDevice1
106
106
```
107
107
@@ -111,11 +111,9 @@ Every command has a `--help` option (alias: `-h`). If it is specified, any other
111
111
112
112
The [help option](./CommandsManual.md#the-help-option) is applicable to a partially specified command, but also may be used to list all available command groups or to list all commands available in one group.
113
113
114
-
**Examples**
114
+
##### Example 1: List all command groups #####
115
115
116
-
**List all command groups**
117
-
118
-
```
116
+
```bash
119
117
> impt --help
120
118
121
119
Usage: impt <command> [options]
@@ -137,9 +135,9 @@ Options:
137
135
[boolean]
138
136
```
139
137
140
-
**List all commands in one group**
138
+
##### Example 2: List all the commands in one group #####
141
139
142
-
```
140
+
```bash
143
141
> impt product --help
144
142
145
143
Usage: impt product <command> [options]
@@ -158,9 +156,9 @@ Options:
158
156
[boolean]
159
157
```
160
158
161
-
**Display a command description**
159
+
##### Example 3: Display a command description #####
Every command has a `--debug` option (alias: `-z`). If it is specified, the tool displays debug information from the command being executed, including impCentral API requests and responses.
183
181
184
-
**Example**
182
+
#### Example ####
185
183
186
-
```
184
+
```bash
187
185
> impt product create --name TestProduct --descr "My test product" --debug
188
186
Doing the request with options:
189
187
{
@@ -263,19 +261,17 @@ A command’s execution output contains one of the two predefined phrases: `IMPT
263
261
264
262
If a command finishes with `IMPT COMMAND FAILS`, it returns non-zero exit code. Otherwise, it returns zero exit code. This can be used by scripts as well.
265
263
266
-
**Example**
267
-
268
-
**A successful command execution**
264
+
##### Example 1: A successful command execution #####
@@ -289,6 +285,8 @@ Calls to the impCentral API need to be authenticated. *impt* provides the [login
289
285
- NOTE: If your username or password contains certain special characters, such as the "!", you may need to wrap the `user_id` and `password`in single quotes to avoid [potential bash interpretation issues](https://ss64.com/bash/bang.html) (e.g. `impt auth login --user 'AUserId' --pwd 'A!Password'`)
290
286
- Using a [login key](#login-keys): `impt auth login --lk <login_key>`
291
287
288
+
You may specify credentials (identifier and password, or login key) directly in the [login command](./CommandsManual.md#auth-login) options. If credentials are not specified, *impt* asks you to choose an authentication method and to input the corresponding credentials.
289
+
292
290
The tool takes care of obtaining an access token and refreshing it using an obtained refresh token or a provided login key. Typically, you need only log in once and can continue using the tool while the refresh token or login key remains valid (ie. not deleted by you). For this purpose, the tool stores the access token and the refresh token/login key in an [auth file](./CommandsManual.md#auth-files).
293
291
294
292
*impt* never stores an account identifier and password. If you do not want the tool to store a refresh token/login key, use the [login command’s](./CommandsManual.md#auth-login) `--temp` option. In this case you will not be able to work with the impCentral API after the access token has expired (usually one hour after issue), and you will have to log in again to continue.
@@ -320,27 +318,39 @@ If you run the [logout command](./CommandsManual.md#auth-logout) with the `--loc
320
318
321
319
At any time you can get known the login status related to any directory. Call the [`impt auth info`](./CommandsManual.md#auth-info) from the required directory. The returned information includes a type of the login applicable to the current directory, access token status, your account ID and other details.
322
320
323
-
**Examples**
324
-
325
-
**Global login**
321
+
##### Example 1: Global login #####
326
322
327
-
```
323
+
```bash
328
324
> impt auth login --user username --pwd password
329
325
Global login is successful.
330
326
IMPT COMMAND SUCCEEDS
331
327
```
332
328
333
-
**Local login using a login key, specifying a endpoint, without storing the login key**
329
+
##### Example 2: Global login without specifying credentials in the options #####
334
330
331
+
```bash
332
+
> impt auth login
333
+
Choose authentication method:
334
+
(1) User/Password
335
+
(2) Login Key
336
+
Enter 1 or 2: 1
337
+
Enter username or email address: username
338
+
Enter password: ********
339
+
Global login is successful.
340
+
IMPT COMMAND SUCCEEDS
335
341
```
342
+
343
+
##### Example 3: Local login using a login key, specifying an endpoint, but without storing the login key #####
*impt* provides a set of [Login Key manipulation commands](./CommandsManual.md#login-key-manipulation-commands) which allows you to fully control your account’s login keys: list the existent login keys, create a new one, delete one, etc. You must be logged inin order to use the commands, which may additionally requires your password.
367
377
368
-
**Example**
378
+
##### Example #####
369
379
370
-
```
380
+
```bash
371
381
> impt loginkey list
372
382
Login Key list (1 items):
373
383
Login Key:
@@ -382,13 +392,11 @@ A Project is an *impt* entity introduced to help developers manage their work. A
382
392
383
393
Projects are intended fordevelopers and are describedin detail in the [*impt* Development Guide](./DevelopmentGuide.md). The tool provides a set of [Project manipulation commands](./CommandsManual.md#project-manipulation-commands). However, many other commands are affected when called from a directory where a [Project file](./CommandsManual.md#project-files) is located. Product, Device Group, Devices, Deployment referenced by the Project file may be assumed by a command when they are not specified in the command’s options explicitly. If you want to avoid that, always specify the mandatory options of the commands. All such options are detailed in the [Command Description](./CommandsManual.md#command-description).
384
394
385
-
**Example**
386
-
387
-
**Unassign all Devices from Device Group**
395
+
##### Example: Unassign all Devices from a Device Group #####
388
396
389
397
A Device Group is not specified in the command below, but the current directory contains a Project File. All Devices are unassigned from the Device Group referenced by that Project File.
390
398
391
-
```
399
+
```bash
392
400
> impt dg unassign
393
401
The following Devices are unassigned successfully from Device Group "dfcde3bd-3d89-6c75-bf2a-a543c47e586b":
394
402
Device:
@@ -414,11 +422,9 @@ If you want to use this feature, please read the [Commands Manual](./CommandsMan
414
422
415
423
When it is hard to uniquely specify an entity without knowing the entity ID, use [entity listing](#entity-listing-and-ownership) commands to view the entities basing on some attributes, choose the required entity and use its entity ID in the required command.
416
424
417
-
**Examples**
425
+
##### Example 1: An entity is found successfully**
418
426
419
-
**An entity is found successfully**
420
-
421
-
```
427
+
```bash
422
428
> impt device info --device 0c:2a:69:05:0d:62
423
429
Device:
424
430
id: 234776801163a9ee
@@ -440,9 +446,9 @@ Device:
440
446
IMPT COMMAND SUCCEEDS
441
447
```
442
448
443
-
**An entity is not unique, so the command fails**
449
+
##### Example 2: An entity is not unique, so the command fails #####
444
450
445
-
```
451
+
```bash
446
452
> impt build info --build MyRC1
447
453
ERROR: Multiple Deployments "MyRC1" are found:
448
454
Deployment:
@@ -483,11 +489,9 @@ As a general rule, if an entity is owned by the current logged-in account, infor
483
489
484
490
To display the Account ID and email of the current account, use [`impt auth info`](./CommandsManual.md#auth-info).
485
491
486
-
**Example**
487
-
488
-
**List all Products owned by me and my collaborators**
492
+
##### Example 1: List all Products owned by me and my collaborators #####
489
493
490
-
```
494
+
```bash
491
495
> impt product list
492
496
impt product list
493
497
Product list (4 items):
@@ -512,9 +516,9 @@ Product:
512
516
IMPT COMMAND SUCCEEDS
513
517
```
514
518
515
-
**List all Factory Device Groups owned by the specified account**
519
+
##### Example 2: List all Factory Device Groups owned by a specified account #####
516
520
517
-
```
521
+
```bash
518
522
> impt dg list --owner user@email.com --dg-type pre-factory --dg-type factory
519
523
Device Group list (2 items):
520
524
Device Group:
@@ -540,9 +544,9 @@ Device Group:
540
544
IMPT COMMAND SUCCEEDS
541
545
```
542
546
543
-
**List all Device Groups owned by me and belonged to the specified Products**
547
+
##### Example 3: List all Device Groups owned by me and belonging to the specified Products #####
544
548
545
-
```
549
+
```bash
546
550
> impt dg list --owner me --product MyProduct --product TestProduct
547
551
Device Group list (4 items):
548
552
Device Group:
@@ -580,9 +584,9 @@ IMPT COMMAND SUCCEEDS
580
584
581
585
Most command groups contain the `info` command, which displays information about the specified entity. Some of that commands have a `--full` option (alias: `-u`). When it is specified, the command displays additional details about the related entities. For example, `impt product info --full` displays the full structure of the Product: details about every Device Group that belongs to the Product, and about devices assigned to the Device Groups.
582
586
583
-
**Example**
587
+
##### Example #####
584
588
585
-
```
589
+
```bash
586
590
> impt product info --product MyProduct --full
587
591
Product:
588
592
id: c4e006ed-85b9-3513-fa99-0700333c3ad7
@@ -619,19 +623,17 @@ By default, commands which delete impCentral entities (eg. Product, Device Group
619
623
620
624
By default, every delete command asks a confirmation of the operation from user. Before that the command lists all the entities which are to be deleted or updated. If you specify the `--confirmed` option (alias: `-q`), the operation is executed without requesting confirmation from the user.
621
625
622
-
**Example**
626
+
##### Example 1: A failed delete command execution #####
623
627
624
-
**A failed delete command execution**
625
-
626
-
```
628
+
```bash
627
629
> impt dg delete --dg MyDevDG --confirmed
628
630
ERROR: Flagged Deployments Exist: Cannot delete a devicegroup with flagged deployments; delete those first.
629
631
IMPT COMMAND FAILS
630
632
```
631
633
632
-
**A successful delete command execution**
634
+
##### Example 2: A successful delete command execution #####
0 commit comments