Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.WriteLine(response.Data);
- RestClient client = new RestClient("https://euterpe.webuntis.com/WebUntis/jsonrpc.do?school=HTL-Perg");
- public void login()
- {
- var request = new RestRequest(Method.POST);
- request.AddHeader("Content-type", "application/jason");
- request.AddJsonBody(new
- {
- id = "ID",
- method = "authenticate",
- @params = new
- {
- user = "kung",
- password = "foo",
- client = "CLIENT"
- },
- jsonrpc = "2.0"
- });
- var response = this.client.Execute<AuthenticationResponse>(request);
- Console.WriteLine(response.Data);
- {"jsonrpc":"2.0","id":"ID","result":{"sessionId":"A173BECFB75F66123D6B678BE9745A29","personType":5,"personId":1234,"klasseId":123}}
- public class AuthenticationResponse
- {
- [DeserializeAs(Name = "id")]
- public int id { get; set; }
- [DeserializeAs(Name = "res")]
- AuthenticationResult res { get; set; }
- }
- public class AuthenticationResult
- {
- [DeserializeAs(Name = "sessionId")]
- string sessionId { get; set; }
- [DeserializeAs(Name = "personType")]
- int personType { get; set; }
- [DeserializeAs(Name = "personId")]
- int personId { get; set; }
- [DeserializeAs(Name = "klasseId")]
- int klasseId { get; set; }
- }
Add Comment
Please, Sign In to add comment