Elastifile REST API using CLI (Quick Reference)

This article is for those who are interesting in quick reference to run REST API commands against the Elastifile system using CLI.

In the code below you can find a general authentication and some API calls.
 

You can always refer to 'REST API Docs' for more details under the following link from your Elastifile web interface:

REST API Docs Menu

 

 

Start API session for the EMS
EMS_IP=35.226.102.236 (example)

curl -k -D session.txt -H "Content-Type: application/json" -X POST -d '{"user": {"login":"admin","password":"'changeme'"}}' https://$EMS_IP/api/sessions


Get system total capacity
curl -k -s -b session.txt --request GET --url https://$EMS_IP/api/system_statistics/  | tr -d '\n' | cut -c6- | jq '.[0].capacity'
{
  "bytes": 61033062334464
}
curl -k -s -b session.txt --request GET --url https://$EMS_IP/api/system_statistics/  | tr -d '\n' | cut -c6- | jq '.[0].free'
{
  "bytes": 58385789321216
}


Get list of DC names
curl -k -s -b session.txt --request GET --url https://$EMS_IP/api/data_containers | tr -d '\n' | cut -c6- | jq '.[].name'
Get hard and soft quota for DC
curl -k -s -b session.txt --request GET --url https://$EMS_IP/api/data_containers | tr -d '\n' | cut -c6- | jq '.[1].hard_quota'
{
  "bytes": 1073741824000
}

curl -k -s -b session.txt --request GET --url https://$EMS_IP/api/data_containers | tr -d '\n' | cut -c6- | jq '.[1].soft_quota'
{
  "bytes": 536870912000
}


Modify soft quota on DC
curl -k -s -b session.txt -H "Content-Type: application/json" --request PUT --url https://$EMS_IP/api/data_containers/2 -d '{"soft_quota":{"bytes":805306368000}}'

curl -k -s -b session.txt --request GET --url https://$EMS_IP/api/data_containers | tr -d '\n' | cut -c6- | jq '.[1].soft_quota'
{
  "bytes": 805306368000
}

Was this helpful?

How can we improve it?
true
Search
Clear search
Close search
Google apps
Main menu
11978479632103987
true
Search Help Center
true
true
true
false
false