Before running any of the Arkindex CLI commands, you need to log into Arkindex.
In your terminal, enter the following command:
You will then be prompted to enter:
- An Arkindex instance URL (
preprod.arkindex.teklia.com...) If you do not enter anything here, the selected instance will be
- The credentials for your account on this Arkindex instance:
- Your e-mail address
- Your password.
Once successfully logged in, you will then be asked to choose a slug to save this authentication profile as. For example, you can save your credentials for
preprod. This profile will then be available when you run any CLI commands. If you run:
arkindex -p preprod elements list --parent $ARKINDEX_ELEMENT_ID
Then the CLI will look for the specified element on
preprod.arkindex.teklia.com, with the access rights of the account you used to log in.
After saving a profile under a slug, you will be asked whether or not you want to set this profile as the default one. The default profile is the one that will be used for running any CLI command if you do not specify another profile using the
-p flag. So if you say
yes to saving the
preprod profile as default, any command you run will target the
preprod.arkindex.teklia.com instance, using the credentials provided for this profile.
Once you have saved a profile as the default one, in order to target a different Arkindex instance or to use different credentials you will need to explicitly use a different profile using the
⚠️ Logging in again using
arkindex login does not override the default profile. If you have saved a default profile, and use
arkindex login to log into a different instance or to use a different account, any command you run afterwards will use the default profile and not the one you just used to log in, unless:
- You replace the existing default profile with this new one, when asked if you want to save this profile as default; or
- You specify the profile to use with the
-pflag. For example, if you have created a new
demoprofile that target the
demo.arkindex.orginstance, and you want to keep your
preprodprofile as the default one, then to list elements on the demo instance you will need to run the command like this:
arkindex -p demo elements list --parent $ARKINDEX_ELEMENT_ID
Logging in using command line arguments
Instead of running the
arkindex login command bare and being prompted to enter the Arkindex instance address, e-mail address and password, you can use arguments to specify the Arkindex instance (
--host) and e-mail address (
arkindex login --host preprod.arkindex.teklia.com --email $firstname.lastname@example.org
You will then be prompted to enter the corresponding password.