1- LOGIN
REST istemci olarak j-Platform da tanımlı kullanıcı bilgileri ile login olunur ve bir token alınır. Sonraki işlemlerde auth-token (client token:token:user) kullanılır.
REST İstemcisi (postman) ile aşağıdaki parametreler kullanılarak istekte bulunabilirsiniz.
Required Informations
Method : POST
Host + Login Path : http://localhost:8080/logo/restservices/rest/login
Header Parametreleri :
accept : application/json
authorization : Basic YWRtaW46bG9nbzEyOjE6MTpdUUlRSs
Örnek Authorization (Base64 encode için : https://www.base64decode.org/)
- Basic BASE64Encode(user:password:ClientToken:Firm:TRTR)
- Basic BASE64Encode(admin:logo12:1:1:TRTR)
Login Response
{
"success": true,
"serviceKey": null,
"authToken": "3e11f7fa1206775136",
"authorization": "Basic YWRtaW46bG9nbzEyOjE6MTpdUUlRSs",
"service": 0
}
Login Request in JAVA
url = new URL("http://localhost:8080/logo/restservices/rest/login");
System.out.println(url);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Accept", "application/json");
CLIENT_TOKEN = UUID.randomUUID().toString();
String header = userName+":" +password+ ":" + CLIENT_TOKEN + ":" + firmNo + ":TRTR";
//admin:logo12:f87ee0de-3402-4171-903e-fd26e666889d:1:TRTR
String basicAuth = "Basic " + Base64.getEncoder().encodeToString(header.getBytes());
conn.setRequestProperty("Authorization", basicAuth);
Login Request in C#
string HEADER = USER_NAME + ":" + PASSWORD + ":" + CLIENT_TOKEN + ":" + FIRM_NO + ":" + LANGUAGE;
//admin:logo12:f87ee0de-3402-4171-903e-fd26e666889d:1:TRTR
string basicAuth = "Basic " + System.Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(HEADER));
HttpWebRequest webrequest = (HttpWebRequest)System.Net.WebRequest.Create("http://localhost:8080/logo/restservices/rest/login");
webrequest.Method = "POST";
webrequest.Accept = "application/json";
webrequest.ContentType = "application/json";
webrequest.Headers.Add("Authorization", basicAuth);
Copyright © 2018 Logo Yazılım