Since I posted my last tutorial blog on how to get started with OneFS API, I’ve received a number of comments from field SEs and partners along the lines of “that’s an awesome list of API resources, but what else can the API do?”

 

I understand that as an engineer, I would much prefer to see a list of API resources, than to dig into the PDF file that is the OneFS API documentation, which can be painful.

 

And here it is… the SINGLE API call that you should know about, which lists all “platform API” resources from your cluster.

https://<your_cluster_IP>:8080/platform/?describe&list&all

 

What does this do?

It lists all platform API resources.  The following list is obtained from running this API call against an OneFS v7.2.1.0 (build 14) simulator:

{

"directory" :

[

"/1/audit/settings",

"/1/audit/topics",

"/1/audit/topics/<NAME>",

"/1/auth/access/<USER>",

"/1/auth/groups",

"/1/auth/groups/<GROUP>",

"/1/auth/groups/<GROUP>/members",

"/1/auth/groups/<GROUP>/members/<MEMBER>",

"/1/auth/id",

"/1/auth/mapping/identities",

"/1/auth/mapping/identities/<SOURCE>",

"/1/auth/mapping/users/lookup",

"/1/auth/mapping/users/rules",

"/1/auth/netgroups/<NETGROUP>",

"/1/auth/privileges",

"/1/auth/providers/ads",

"/1/auth/providers/ads/<ID>",

"/1/auth/providers/ads/<ID>/controllers",

"/1/auth/providers/ads/<ID>/domains",

"/1/auth/providers/ads/<ID>/domains/<ADS-DOMAIN>",

"/1/auth/providers/ads/<ID>/search",

"/1/auth/providers/file",

"/1/auth/providers/file/<ID>",

"/1/auth/providers/krb5",

"/1/auth/providers/krb5/<ID>",

"/1/auth/providers/ldap",

"/1/auth/providers/ldap/<ID>",

"/1/auth/providers/local",

"/1/auth/providers/local/<ID>",

"/1/auth/providers/nis",

"/1/auth/providers/nis/<ID>",

"/1/auth/providers/summary",

"/1/auth/roles",

"/1/auth/roles/<ROLE>",

"/1/auth/roles/<ROLE>/members",

"/1/auth/roles/<ROLE>/members/<MEMBER>",

"/1/auth/roles/<ROLE>/privileges",

"/1/auth/roles/<ROLE>/privileges/<PRIVILEGE>",

"/1/auth/settings/global",

"/1/auth/settings/krb5/defaults",

"/1/auth/settings/krb5/domains",

"/1/auth/settings/krb5/domains/<DOMAIN>",

"/1/auth/settings/krb5/realms",

"/1/auth/settings/krb5/realms/<REALM>",

"/1/auth/settings/mapping",

"/1/auth/shells",

"/1/auth/users",

"/1/auth/users/<USER>",

"/1/auth/users/<USER>/change_password",

"/1/auth/users/<USER>/member_of",

"/1/auth/users/<USER>/member_of/<MEMBER_OF>",

"/1/auth/wellknowns",

"/1/auth/wellknowns/<WELLKNOWN>",

"/1/cloud/accounts",

"/1/cloud/accounts/<ACCOUNT>",

"/1/cloud/jobs",

"/1/cloud/jobs-files/<JOB>",

"/1/cloud/jobs/<JOB>",

"/1/cloud/pools",

"/1/cloud/pools/<POOL>",

"/1/cloud/settings",

"/1/cloud/settings/encryption_key",

"/1/cluster/config",

"/1/cluster/external-ips",

"/1/cluster/identity",

"/1/cluster/statfs",

"/1/cluster/time",

"/1/debug/echo/<TOKEN>",

"/1/debug/stats",

"/1/dedupe/dedupe-summary",

"/1/dedupe/reports",

"/1/dedupe/reports/<ID>",

"/1/dedupe/settings",

"/1/filepool/default-policy",

"/1/filepool/policies",

"/1/filepool/policies/<POLNAME>",

"/1/filepool/templates",

"/1/filepool/templates/<NAME>",

"/1/filesystem/settings/access-time",

"/1/filesystem/settings/character-encodings",

"/1/fsa/path",

"/1/fsa/results",

"/1/fsa/results/<ID>",

"/1/fsa/settings",

"/1/job/events",

"/1/job/job-summary",

"/1/job/jobs",

"/1/job/jobs/<JID>",

"/1/job/policies",

"/1/job/policies/<NAME>",

"/1/job/reports",

"/1/job/statistics",

"/1/job/types",

"/1/job/types/<NAME>",

"/1/license/eula",

"/1/license/licenses",

"/1/license/licenses/<NAME>",

"/1/protocols/hdfs/proxyusers",

"/1/protocols/hdfs/proxyusers/<NAME>",

"/1/protocols/hdfs/proxyusers/<NAME>/members",

"/1/protocols/hdfs/proxyusers/<NAME>/members/<MEMBER>",

"/1/protocols/hdfs/racks",

"/1/protocols/hdfs/racks/<ID>",

"/1/protocols/hdfs/settings",

"/1/protocols/nfs/check",

"/1/protocols/nfs/exports",

"/1/protocols/nfs/exports-summary",

"/1/protocols/nfs/exports/<EID>",

"/1/protocols/nfs/nlm/locks",

"/1/protocols/nfs/nlm/sessions",

"/1/protocols/nfs/nlm/sessions/<ID>",

"/1/protocols/nfs/nlm/waiters",

"/1/protocols/nfs/reload",

"/1/protocols/nfs/settings/export",

"/1/protocols/nfs/settings/global",

"/1/protocols/smb/openfiles",

"/1/protocols/smb/openfiles/<ID>",

"/1/protocols/smb/sessions",

"/1/protocols/smb/sessions/<COMPUTER>",

"/1/protocols/smb/sessions/<COMPUTER>/<USER>",

"/1/protocols/smb/settings/global",

"/1/protocols/smb/settings/share",

"/1/protocols/smb/shares",

"/1/protocols/smb/shares-summary",

"/1/protocols/smb/shares/<SHARE>",

"/1/quota/license",

"/1/quota/quotas",

"/1/quota/quotas-summary",

"/1/quota/quotas/<QID>",

"/1/quota/quotas/<QID>/notifications",

"/1/quota/quotas/<QID>/notifications/<NID>",

"/1/quota/reports",

"/1/quota/reports/<RID>",

"/1/quota/reports/<RID>/about",

"/1/quota/settings/mappings",

"/1/quota/settings/mappings/<ID>",

"/1/quota/settings/notifications",

"/1/quota/settings/notifications/<NID>",

"/1/quota/settings/reports",

"/1/remotesupport/connectemc",

"/1/snapshot/aliases",

"/1/snapshot/aliases/<SID>",

"/1/snapshot/changelists",

"/1/snapshot/changelists/<CHANGELIST>",

"/1/snapshot/changelists/<CHANGELIST>/lins",

"/1/snapshot/changelists/<CHANGELIST>/lins/<LIN>",

"/1/snapshot/license",

"/1/snapshot/pending",

"/1/snapshot/repstates",

"/1/snapshot/repstates/<REPSTATE>",

"/1/snapshot/schedules",

"/1/snapshot/schedules/<SID>",

"/1/snapshot/settings",

"/1/snapshot/snapshots",

"/1/snapshot/snapshots-summary",

"/1/snapshot/snapshots/<SID>",

"/1/snapshot/snapshots/<SID>/locks",

"/1/snapshot/snapshots/<SID>/locks/<LID>",

"/1/statistics/current",

"/1/statistics/history",

"/1/statistics/keys",

"/1/statistics/keys/<KEY>",

"/1/statistics/protocols",

"/1/storagepool/compatibilities/class/active",

"/1/storagepool/compatibilities/class/active/<ID>",

"/1/storagepool/compatibilities/class/available",

"/1/storagepool/compatibilities/ssd/active",

"/1/storagepool/compatibilities/ssd/active/<ID>",

"/1/storagepool/compatibilities/ssd/available",

"/1/storagepool/nodepools",

"/1/storagepool/nodepools/<NID>",

"/1/storagepool/settings",

"/1/storagepool/status",

"/1/storagepool/storagepools",

"/1/storagepool/suggested_protection/<NID>",

"/1/storagepool/tiers",

"/1/storagepool/tiers/<TID>",

"/1/storagepool/unprovisioned",

"/1/sync/history/file",

"/1/sync/history/network",

"/1/sync/jobs",

"/1/sync/jobs/<JOB>",

"/1/sync/license",

"/1/sync/policies",

"/1/sync/policies/<POLICY>",

"/1/sync/policies/<POLICY>/reset",

"/1/sync/reports",

"/1/sync/reports-rotate",

"/1/sync/reports/<RID>",

"/1/sync/reports/<RID>/subreports",

"/1/sync/reports/<RID>/subreports/<SID>",

"/1/sync/rules",

"/1/sync/rules/<RULE>",

"/1/sync/settings",

"/1/sync/target/policies",

"/1/sync/target/policies/<POLICY>",

"/1/sync/target/policies/<POLICY>/cancel",

"/1/sync/target/reports",

"/1/sync/target/reports/<RID>",

"/1/sync/target/reports/<RID>/subreports",

"/1/sync/target/reports/<RID>/subreports/<SID>",

"/1/worm/domains",

"/1/worm/domains/<DOMAIN+>",

"/1/worm/settings",

"/1/zones",

"/1/zones-summary",

"/1/zones-summary/<ZONE>",

"/1/zones/<ZONE>",

"/2/cluster/external-ips",

"/2/event/events",

"/2/event/events/<ID>",

"/2/protocols/nfs/aliases",

"/2/protocols/nfs/aliases/<AID>",

"/2/protocols/nfs/check",

"/2/protocols/nfs/exports",

"/2/protocols/nfs/exports-summary",

"/2/protocols/nfs/exports/<EID>",

"/2/protocols/nfs/nlm/locks",

"/2/protocols/nfs/nlm/sessions",

"/2/protocols/nfs/nlm/sessions/<ID>",

"/2/protocols/nfs/nlm/waiters",

"/2/protocols/nfs/reload",

"/2/protocols/nfs/settings/export",

"/2/protocols/nfs/settings/global",

"/2/protocols/nfs/settings/zone"

]

}

 

Here’s a little script that lets you get the above list, just plug in your cluster IP address and credentials:

[20:11:05]rchang@USENCHANGR4L4C ~/api-work/orca $ cat get-all-papi-resources.sh

# my isilon target

my_cluster="192.168.64.2"

 

# my creds

username=root

password=aa

 

# prep auth.json file

echo "{ \

\"username\":\"${username}\", \

\"password\":\"${password}\", \

\"services\":[\"platform\",\"namespace\"] \

} " > auth.json

 

# get session cookie

curl -k --insecure -H "Content-Type: application/json" -c cookiefile -X POST -d @auth.json https://${my_cluster}:8080/session/1/session

 

# get a list of all platform API resources

curl -k --insecure -b @cookiefile "https://${my_cluster}:8080/platform/?describe&list&all"

 

I also find it useful to make a call against every single one of these platform API resources to see what their default output looks like.  For that, here’s another little script that obtains the above list of API resources, strips away the ones that require specific parameters such as <ID>, and then makes a call to that API resource.  Be sure to spool the output to a file for your referencing/grepping needs.

 

[20:14:42]rchang@USENCHANGR4L4C ~/api-work/orca $ cat get-platform-api-resources-and-invoke.sh

 

# my isilon target

my_cluster="192.168.64.2"

 

# my creds

username=root

password=aa

 

# prep auth.json file

echo "{ \

\"username\":\"${username}\", \

\"password\":\"${password}\", \

\"services\":[\"platform\",\"namespace\"] \

} " > auth.json

 

# get session cookie

curl -k --insecure -H "Content-Type: application/json" -c cookiefile -X POST -d @auth.json https://${my_cluster}:8080/session/1/session

 

# get all available APIs, and make the call to each

for api_handler in `curl -k --insecure -b @cookiefile "https://${my_cluster}:8080/platform/?describe&list&all" | sed 's/\"//g' | sed 's/\,//g' | sed 's/\[//g' | sed 's/\]//g' | sed 's/{//g' | sed 's/}//g' | sed 's/directory//g' | sed 's/\://g' | grep -v ">" | sort`

do

echo "==============================================================="

echo REQUEST -- https://${my_cluster}:8080/platform${api_handler}

echo "==============================================================="

curl -k --insecure -H '"Content-Type: application/json"' -b cookiefile https://${my_cluster}:8080/platform${api_handler}

echo

done

 

Related Resources

 

Cheers.