
Attachment uploads are currently disabled. This is a temporary situation and will resume as normal in the coming days.
UNSOLVED
Isilon API with curl
I could not find any examples of how to connect to and use the platform API and I thought this may be usefull. I'm using curl from the command line. I'd love to see other ways to use the API and how the json outputs can be parsed.
Create a file to be used for the the initial authentication (auth.json) with the following text:
{
"username": "root",
"password": "password",
"services": ["platform","namespace"]
}
POST the content of auth.json file to create a session and save authorization cookie in file cookiefile:
curl -k --header "Content-Type: application/json" \
-c cookiefile -X POST -d @auth.json https://10.250.25.239:8080/session/1/session
Use the cookiefile to list the session and to confirm that you're authenticated
curl -k -b @cookiefile https://10.250.25.239:8080/session/1/session?isisessid
output :
{"services":["platform","namespace"],"timeout_absolute":14400,"timeout_inactive":900,"username":"root"}
Use the cookiefile for all methods from now on (curl -k -b @cookiefile .. )
For example GET to list a resource or a collection (in this case all NFS exports)
curl -k -b @cookiefile https://10.250.25.239:8080/platform/1/protocols/nfs/exports/
output truncated :
{"exports":[{"all_dirs":true,"block_size":8192,"can_set_time":true,"clients": ... }
Creating a resource (NFS export) : create a file (create_export_test4.json ) to use with POST
{
"clients": ["hostname.un.org"],
"description": "testing API Creation",
"paths": ["/ifs/test4","/ifs/test5"]
}
POST it to the appropriate resource path:
curl -k --header "Content-Type: application/json" -b cookiefile \
-X POST -d @create_export_test4.json -X POST https://10.250.25.239:8080/platform/1/protocols/nfs/exports
on success returns the ID of the created export:
{"id":3}
GET the export resource that was just created (ID 3) :
curl -k -b @cookiefile https://10.250.25.239:8080/platform/1/protocols/nfs/exports/3
output truncated :
{"exports":[{"all_dirs":false,"block_size":8192,"can_set_time":true,"clients" ..... :,"write_unstable_reply":"UNSTABLE"}]}
DELETE resource (export with ID 3 that we just created)
curl -k -b @cookiefile -X DELETE https://10.250.25.239:8080/platform/1/protocols/nfs/exports/3
Responses (0)
Solutions (0)
