相关文章推荐
The API is only exposed to a service account which is configured in the
General Configuration
To log in, you must perform form authentication to
Identity Portal
. The following code is an example to use java to perform login to
Identity Portal
using org.apache.commons.httpclient.HttpClient.
private void login String username  String password
throws
HttpException  IOException  LoginException  debug "Logging into Sigma" String loginUrl  sigmaUrl  loginSuffix debug "Login URL is: "   loginUrl PostMethod postMethod   PostMethod loginUrl NameValuePair  postData   NameValuePair postData  NameValuePair "j_username"  username postData  NameValuePair "j_password"  password postMethod addParameters postData int loginResult  httpclient executeMethod postMethod debug "Login post returned Http Status: ["   loginResult  loginResult  error "Error logging into Sigma with username: ["   username
throw
LoginException "Error Logging into Sigma: "   postMethod getResponseBodyAsString Header locationHeader   postMethod getResponseHeader "Location" locationHeader getValue substring locationHeader getValue lastIndexOf startsWith "/app" error "Error logging into Sigma with username: ["   username
throw
LoginException "Error Logging into Sigma" postMethod releaseConnection debug "Login successful"
After the HTTP client is logged in, you can use it to POST method to the APIs exposed.
 
推荐文章