1 Message

June 6th, 2018 10:00

Thanks. This was huge for me as I was trying to write some .Net code and I kept getting '401' error messages when trying to do a GET on "session/1/session" using my cookie session. I didn't have access to any of the README notes - just the API documentation online. Initially testing on a VM things worked fine, but when switching to our production Isilon, that's when I started getting the authorization errors. I was always wondering when creating the cookie for the very first time what the 'isicsrf' value was for. It wasn't mentioned in the API documentation so I just ignored it.

For any others that may need a start, here is what I used to get session info (GET "session/1/session") about my current cookie.

CookieID - the value of 'isisessid=xxxxxx' from the cookie

CookieCSRF -  the value of 'yyyyyy' from the cookie with the 'isicsrf=' removed

isilonUrl - the address of your isilon - 'https://1.1.1.1:8080'

using (var client = new HttpClient(new HttpClientHandler { UseCookies = false }))

                {

                    client.DefaultRequestHeaders.Add("Cookie", CookieID);

                    client.DefaultRequestHeaders.Add("X-CSRF-Token", CookieCSRF);

                    client.DefaultRequestHeaders.Add("Referer", isilonUrl);

                    var response = await client.GetAsync(

                        isilonUrl + "/session/1/session");

                    response.EnsureSuccessStatusCode();

                    //get the session information

                    var body = await response.Content.ReadAsStringAsync();

                }

1 Message

May 25th, 2023 13:00

This helped me a lot. Thanks.

For the ones using curl, to get the Cookie is like this one below:

curl --location --request POST  ' https://10.1.1.1:8080/session/1/session'  \
--header  'Content-Type: application/json'  \
--data-raw  '{
"username" :  "user" ,
"password" :  "password" ,
"services" : [ "platform"  ]
} '
 

From your response you get the cookie data to be used for consequent curls. Like this below for instance: (values are examples, not my actual ones).

 

curl --location --request GET  ' https://10.1.1.1:8080/platform/3/cluster/version'  \
--header  'Cookie: isisessid=98fe7d6c-543b-2a1f-0987-e654d3cb21a0'  \
--header  'X-CSRF-Token: 987dc6b5-a432-1f09-e876-543d2c10b9a8'  \
--header  'Referer:  https://10.1.1.1:8080/'
 
 
No Events found!

Top