Login - OpenWilma/parsing GitHub Wiki
Login is fairly easy.
First, do a GET request to https://<wilmaserver>/index_json to get SessionId:
{
"LoginResult": "Failed",
"SessionID": "<SESSIONID>",
"ApiVersion": 11,
"Workers": [],
"oidc_test_mode": false,
"oidc_providers": []
}
Secondly, do a POST request to https://<wilmaserver>/login. This will log you into Wilma and give you a session cookie.
POST body (formdata):
-
Login: Username -
Password: Password -
SESSIONID: SessionId you got earlier -
CompleteJson: This key forces Wilma to give every request available in JSON format as JSON instead of HTML -
format: Format for error response and misc.
Note that there isn't a JSON response, so you cannot follow redirects. You have to tell your HTTP client to disable following redirects.
If login fails (invalid password or username), you'll be redirected to:
https://<wilmaserver>/?loginfailed.
If it succeeds, you'll be redirected to: https://<wilmaserver>/?checkcookie.
You'll get a cookie Wilma2SID, your session token. Save this cookie for future requests.
Error response:
{
"error": {
"id": "example-1",
"message": "Some weird error",
"description": "Don't worry, this is an example ;-)",
"whatnext": "",
"statuscode": 403
}
}