Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • W wilma_daycare_api
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Developer From Jokela
  • wilma_daycare_api
  • Wiki
  • POST Authentication

POST Authentication · Changes

Page history
Created POST Authentication (markdown) authored Mar 18, 2020 by Developer From Jokela's avatar Developer From Jokela
Show whitespace changes
Inline Side-by-side
POST-Authentication.md 0 → 100644
View page @ d1e4b75a
This `POST`&`GET` request will authenticate you with the Wilma
***
_Basepath_ for logging in: `https://<your_wilma_server>/login`
_Basepath_ for obtaining the Session ID: `https://<your_wilma_server>/index_json`
***
### Obtaining the Session ID
You can obtain the Session ID by requesting an `GET` request to the:
> _Basepath_ for obtaining the Session ID
You'll get this as a **successful response**:
{
"LoginResult": "Failed",
"SessionID": "<the_session_id>",
"ApiVersion": 10,
"Workers": []
}
And if it manages to fail, here's an example `error response`:
{
"error": {
"id": "example-1",
"message": "Some weird error",
"description": "Don't worry, this is an example ;-)",
"whatnext": "",
"statuscode": 403
}
}
Take down the `SessionID` from the successful response, and we can continue to the login
***
### Login request
In order to login, you should to a `POST` request to the:
> _Basepath_ for logging in: `https://<your_wilma_server>/login`
These are the `POST` parameters:
* `Login` - Username
* `SESSIONID` - The SessionID we got in the previous response
* `CompleteJson` - Value: `` (leave it empty) This is not a required parameter, basically it will get every page from Wilma server as json (don't confuse it with the JSON response, it just sets a `Content-Type` header to `application/json`. Althrough on some pages it will give you JSON response)
* `ApiKey` - Generate a SHA1 key using this example: (`<Login>|<SessionID>|<API_KEY>`). `<Login>` is the username, `<SessionID>` you are familiar with, now `<API_KEY>` is a weird one. You can't get it easily. Only ways is to send a request to Visma (if no one answers, write directly to the CEO and magic will happen), or (little bit illegal) go and extract it from their app
* `Password` - The password of user
* `format` - Use value `json` so you will get all error messages in this request as JSON response
Done with parameters, finally send it.
If the authentication went successfully, you'll get the homepage of the user:
{
"LoginResult": "Ok",
"WilmaId": "888f7a471f187aedd6a258c4b67e2154s5741ds1",
"ApiVersion": 10,
"FormKey": "student:87654:1f8ef7cc65954655a34a2312145",
"ConnectIds": [],
"Name": "Developer From Jokela",
"Type": 2,
"PrimusId": 87654,
"School": "Example school",
"Exams": [],
"Observations": [],
"News": [],
"Groups": [],
"Photo": "",
"EarlyEduUser": false,
"Roles": []
}
**One last note: **Remember to save the `Wilma2SID` cookie, it's your session cookie, it lasts about 25 minutes if not used
And you get this error response if something went wrong:
{
"LoginResult": "Failed",
"SessionID": "<the_session_id>",
"ApiVersion": 10,
"Workers": []
}
Now you're done to do more requests.
All other requests get this kind of error response:
{
"error": {
"id": "example-1",
"message": "Some weird error",
"description": "Don't worry, this is an example ;-)",
"whatnext": "",
"statuscode": 403
}
}
Clone repository
  • Error response
  • GET Absence list
  • GET Wilma Servers
  • Home
  • POST Authentication