Login Documentation - gopai/reporting-sdk GitHub Wiki
Login Documentation
The login process requires an HTTP POST request. Several headers are required including User-Agent
, Content-Type
, and a Method
of POST
.
// Java example showing connection creation for login
URL url = new URL(BASE_URL + "Login.event");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("User-Agent", "Mozilla/5.0");
con.setDoOutput(true);
con.setInstanceFollowRedirects(false);
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
con.setRequestMethod("POST");
What is required for further requests is a JSESSIONID
. This token represents your session with PAI Reports and is required for all communications. This parameter is communicated to the server using the Cookie header. The JSESSIONID can be obtained through Cookie management and will also be returned by the Login event on successful login.
// Java example showing setting the cookie property of a connection
con.setRequestProperty("Cookie", "JSESSIONID=94F35B89002804BE569C3D1A2A12BC95.IoI;");
The login event Login.event
requires Username
and Password
. These two fields must be transmitted in application/x-www-form-urlencoded
format. Make sure you match case as all parameters are case sensitive.