This post is more than 5 years old
1 Rookie
•
4 Posts
0
2155
June 11th, 2015 00:00
How to use REST API
I build ScaleIO REST Client.
I succeed login using "/api/login"parameter,and the login returns token(key) "xxxxx" .
↓
C# code "HTTP Basic authentication"
--
string authInfo = @"admin:password";
authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
request.Headers["Authorization"] = "Basic " + authInfo;
--
but,I don't know use token(key) "xxxxx".
For example,when I invoke HTTP GET request using "/api/instances/"parameter,
returns authentication erorr(401) at System.Net.WebException.
C# code
--
reqest.Headers["-Auth-Tken"] = "xxxxx"; // "xxxxx" is access_token.
--
No Events found!
quanghoc
1 Rookie
•
40 Posts
0
June 11th, 2015 09:00
For all sub-sequence API calls, you just need to pass the token without username in base64 encode to the request header. So something like this:
(I'm not C# expert)
chi_sox
19 Posts
0
June 11th, 2015 05:00
Did you insure the following:
Gateway service is running
The password was set in the gatewayUser.properties file
yamachan1
1 Rookie
•
4 Posts
0
June 14th, 2015 21:00
I did as you described,it works.
Thank you!!