-
Notifications
You must be signed in to change notification settings - Fork 0
API for Users
michaelkringelhede edited this page Oct 22, 2022
·
6 revisions
Check whether a username is in use:
GET /api/locations/:location/users/:name
Response for /api/locations/79b42f6d-bfa2-49e9-ab07-542359864877/users/arthur will be similar to:
{
"found": true,
"error": null,
"errorCode": null
}
Users can be created using the API:
POST /api/locations/:location/users
{
"name": "Arthur",
"password": "THGTTG-42"
}
Response for /api/locations/79b42f6d-bfa2-49e9-ab07-542359864877/users will be similar to:
{
"id": "13b579ee-fcb8-409b-83f3-e1ce96935276",
"created": true,
"token": "eyJhbGciOiJ...zdOUex7uEFQjf-Kw",
"error": null,
"errorCode": null
}
Once the user is create you can use the token returned from user creation or you can fetch a new token like this:
POST /api/locations/:location/users/login
{
"name": "Arthur",
"password": "THGTTG-42"
}
Response for /api/locations/79b42f6d-bfa2-49e9-ab07-542359864877/users/login will be similar to:
{
"successful": true,
"token": "eyJhbGciOiJ...zdOUex7uEFQjf-Kw",
"errorCode": null,
"error": null
}
Users can send JID codes to the server by using the jid endpoint.
The login token should be sent as value to the authorization
header.
POST /api/locations/:location/jid
Authorization: eyJhbGciOiJ...zdOUex7uEFQjf-Kw
{
"jid": "5dk67x"
}
Response for /api/locations/79b42f6d-bfa2-49e9-ab07-542359864877/jid will be similar to:
{
"saved": true,
"code": {
"userid": "13b579ee-fcb8-409b-83f3-e1ce96935276",
"jid": "5dk67x",
"country": "dk",
"created": "2022-10-18T16:26:50+02:00"
},
"errorCode": null,
"error": null
}