...
- These examples use bash, curl, and jq, feel free to use the language of your choice
- To use the RestAPI you will need a TOKEN:
- For clarity we define the variable $CURL and $SERV for future use (see below)
Code Block | ||
---|---|---|
| ||
TOKEN=$(curl -s -k -H 'Accept: application/json' -H 'Content-Type: application/json' -X POST --data '{"acct":"'filestat'","pass":"'filestat'"}' https://hssrv2.dmawi.de:8080/v1/security/login | jq -r '.response')
CURL='curl -s -k -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN"'SERV='https://hssrv2.dmawi.de:8080/v1' |
- The token lifespan is 24 h and not client/server dependent
...
- You can execute (some) commands on the ScoutAM servers using ssh hssrv2 <command>
- The ScoutAM use your (standard) AWI $HOME. We suggest to create an ssh key pair with a passphrase (e.g., https://www.ssh.com/academy/ssh/keygen) there.
Specific taks
filestat (e.g. online/offline)
...
- We use these variables for testing. Please note that the variable for several files have to formatted differently, depending on the preferred assess method.
- single file: F=/hs/store/users/2023/2023-11-30_liegmahl/home_edvs1.tgz
multiple files:FA="/hs/store/users/2023/2023-11-30_liegmahl/*"
FB="/hs/store/users/2023/2023-11-30_liegmahl/home_edvs1.tgz:/hs/store/users/2023/2023-11-30_liegmahl/isibhv_personal.tgz:/hs/store/users/2023/2023-11-30_liegmahl/isipd_home_pd.tgz"
FC='"store/users/2023/2023-11-30_liegmahl/home_edvs1.tgz","store/users/2023/2023-11-30_liegmahl/isibhv_personal.tgz","store/users/2023/2023-11-30_liegmahl/isipd_home_pd.tgz"'
- Some additional tasks can be done with ssh hssrv2 saminfo.sh
filestat
language | bash |
---|
Task | RestAPI | ssh hssrv | saminfo.sh |
---|---|---|---|
filestat | eval $CURL -X GET $SERV/file?path="$F" eval $CURL -X PUT --data \'{\"path\":[$FC]}\' $SERV/batchfile | sls -D $F | saminfo.sh -f $F |
online/offline | eval $CURL -X GET $SERV/file?path="$F" | jq -r .onlineblocks eval $CURL -X PUT --data \'{\"path\":[$FC]}\' $SERV/batchfile | jq -r '.infos[] | {path, onlineblocks, error}' | saminfo.sh -o -f $F | |
staging | eval $CURL -X POST $SERV/request/stage?path="$F" eval $CURL -X PUT --data \'{\"path\":[$FC]}\' $SERV/request/batchstage | stage $F | saminfo.sh -s $F |