Configure Instances
Instead of storing usernames and passwords, imputation-bot is using API tokens to communicate with Michigan Imputation Server or any other clone. A list of all supported instances can be found here.
This approach has several advantages compared to user credentials:
- tokens can be revoked by the user at any time (e.g. if token is compromised),
- tokens have only access to a limited number of API endpoints (e.g. job handling) and it is therefore not possible to change user credentials via the API
- tokens are valid for 30 days but can be easily renewed using imputation-bot.
The complete data exchange between imputation-bot and MIS is encrypted using Secure Sockets Layer (SSL).
Obtain API Token
Please navigate to the Michigan Imputation Server website or to an other supported instance:
Step 1: Login and click on your username and then on profile:
Step 2: Click on Create API Token
Step 3: Copy your API Token and paste it when imputationbot add-instance
asks for it.
Api Tokens are valid for 30 days. You can check the status in the web interface or with imputationbot instances
Add instance
imputationbot add-instance
Output:
imputation-bot 1.0.0 ๐ค
https://imputationserver.sph.umich.edu
(c) 2019 Lukas Forer, Sebastian Schoenherr and Christian Fuchsberger
Built by lukas on 2019-10-09T15:54:07Z
Imputationserver Url [https://imputationserver.sph.umich.edu]:
API Token [None]: eyJjdHkiOiJ0ZXh0XC9wbGFpbiIsImFsZyI6IkhTMjU2In0.eyJtYWlsIjoibHVrYXMuZm9yZXJAaS1tZWQuYWMuYXQiLCJleHBpcmUiOjE1NzMyMjkwNTY3NTEsIm5hbWUiOiJMdWthcyBGb3JlciIsImFwaSI6dHJ1ZSwidXNlcm5hbWUiOiJsdWtmb3IifQ.qY7iEM6ul-gJ0EuHmEUHRnoS5hZs7kD1HC95NFaxE9w
All instances and tokens are stored locally in ~/.imputationbot/imputationbot.instances
.
List instances
A list of all instances including the ID can be obtained with instances
:
imputationbot instances
Output:
imputation-bot 1.0.0 ๐ค
https://imputationserver.sph.umich.edu
(c) 2019 Lukas Forer, Sebastian Schoenherr and Christian Fuchsberger
Built by lukas on 2019-10-09T15:54:07Z
โโโโโโคโโโโโโโโโโโโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโคโโโโโโโโโโโคโโโโโโโโโโคโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ID โ Name โ Hostname โ Username โ Version โ Token expires on โ
โ โโโโโชโโโโโโโโโโโโโโโโโโโโโโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโชโโโโโโโโโโโชโโโโโโโโโโชโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ 1 โ Michigan Imputation Server โ https://imputationserver.sph.umich.edu โ lukfor โ 1.2.4 โ Fri Dec 27 13:14:48 CET 2019 โ
โโโโโโงโโโโโโโโโโโโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโงโโโโโโโโโโโงโโโโโโโโโโงโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
In addition to general information about the instance itself, the status and expiration date of the API token is shown.
Update instance
If a API Token is expired, the update-instance
command can be used to update the token:
imputationbot update-instance [<ID> <TOKEN>]
A list of all instances including the ID can be obtained with instances
. If no ID and token are set via the command-line, a list of all instances appears and an instance can be selected as well as the new token can be entered.
Remove instance
To remove an existing instance, the delete-instance
command can be used:
imputationbot remove-instance [<ID>]
A list of all instances including the ID can be obtained with instances
. If no ID is set via the command-line, a list of all instances appears where an instance can be selected.