Backend API for the User Management Server.
Can do everything related to user management, i.e. the admin can do everything that a researcher can and more. However, the admin cannot run queries on the blockchain.
POST http://localhost:8088/api/users/register
The generated username and password will be sent to the specified email.
| Header | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk |
{
"first_name": "John",
"last_name": "Doe",
"email": "J.Doe@tudelft.nl",
"affiliation": "Delft University of Technology"
}curl --location 'http://localhost:8088/api/users/register' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk' \
--data-raw '{
"first_name": "John",
"last_name": "Doe",
"email": "J.Doe@tudelft.nl",
"affiliation": "Delft University of Technology"
}'201 CREATED
This request does not return any response body.
GET http://localhost:8088/api/users/researchers
| Header | Value |
|---|---|
| Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk |
curl --location 'http://localhost:8088/api/users/researchers' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk'200 OK
[ {
"user_id" : "8eeda5c8-8a4c-47de-bdac-880e8c69c233",
"first_name" : "John",
"last_name" : "Doe",
"email" : "J.Doe@tudelft.nl",
"affiliation" : "Delft University of Technology"
}, {
"user_id" : "0abe1518-07a1-4782-a2fa-af4a5a2adf6b",
"first_name" : "Jane",
"last_name" : "Doe",
"email" : "J.Doe-1@tudelft.nl",
"affiliation" : "Delft University of Technology"
} ]PUT http://localhost:8088/api/users/update?user_id=8eeda5c8-8a4c-47de-bdac-880e8c69c233
| Header | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk |
| Parameter | Value |
|---|---|
| user_id | 8eeda5c8-8a4c-47de-bdac-880e8c69c233 |
{
"first_name": "John",
"last_name": "Roe",
"affiliation": "Delft University of Technology"
}curl --location --request PUT 'http://localhost:8088/api/users/update?user_id=8eeda5c8-8a4c-47de-bdac-880e8c69c233' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk' \
--data '{
"first_name": "John",
"last_name": "Roe",
"affiliation": "Delft University of Technology"
}'200 OK
This request does not return any response body.
DELETE http://localhost:8088/api/users/delete?user_id=8eeda5c8-8a4c-47de-bdac-880e8c69c233
| Header | Value |
|---|---|
| Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk |
| Parameter | Value |
|---|---|
| user_id | 8eeda5c8-8a4c-47de-bdac-880e8c69c233 |
curl --location --request DELETE 'http://localhost:8088/api/users/delete?user_id=8eeda5c8-8a4c-47de-bdac-880e8c69c233' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk'200 OK
This request does not return any response body.
A researcher can only log in, change their password and query the chain.
POST http://localhost:8088/api/users/login
After a successful login attempt, the server sends back a JWT with the specified expiration time (in minutes).
| Header | Value |
|---|---|
| Content-Type | application/json |
{
"username": "jdoe",
"password": "%n&Z*4vRj@q@S9ww3eUpX))4)s7&p+)8W]TljG4i"
}curl --location 'http://localhost:8088/api/users/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "jdoe",
"password": "%n&Z*4vRj@q@S9ww3eUpX))4)s7&p+)8W]TljG4i"
}'200 OK
{
"jwt": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI3NTlhYTIwYy0zMTA2LTRhYzgtODNjNi02MjQzMGUzMTYxNDkiLCJyb2xlIjoiUkVTRUFSQ0hFUiIsImlhdCI6MTcwODkyNTAxMywiZXhwIjoxNzA4OTI4NjEzfQ.QiEpuZOzpUHE8bKWJ35nIqTjSw835pa-7HPgSl-HUJI",
"token_type": "JWT",
"expires_in": 15
}PUT http://localhost:8088/api/users/change_password
| Header | Value |
|---|---|
| Content-Type | application/json |
{
"username": "jdoe",
"old_password": "%n&Z*4vRj@q@S9ww3eUpX))4)s7&p+)8W]TljG4i",
"new_password": "more_secure_password"
}curl --location --request PUT 'http://localhost:8088/api/users/change_password' \
--data '{
"username": "jdoe",
"old_password": "weak_password",
"new_password": "more_secure_password"
}'200 OK
This request does not return any response body.
POST http://localhost:8088/api/queries
| Header | Value |
|---|---|
| Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk |
{
"query_type" : "AVERAGE",
"device_type" : "WEARABLE_DEVICE",
"hospital_list" : {
"hospitals" : [ "LIFECARE", "MEDIVALE", "HEALPOINT" ]
},
"start_time" : "2024-03-29T16:26:01.141238759Z",
"stop_time" : "2024-03-29T16:26:01.141332438Z",
"field" : "rental_price"
}curl --location 'http://localhost:8088/api/queries' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk' \
--data '{
"query_type" : "AVERAGE",
"device_type" : "WEARABLE_DEVICE",
"hospital_list" : {
"hospitals" : [ "LIFECARE", "MEDIVALE", "HEALPOINT" ]
},
"start_time" : "2024-03-29T16:26:01.141238759Z",
"stop_time" : "2024-03-29T16:26:01.141332438Z",
"field" : "rental_price"
}'200 OK
{
"result": 0
}POST http://localhost:8088/api/queries
| Header | Value |
|---|---|
| Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk |
{
"query_type" : "COUNT",
"device_type" : "PORTABLE_DEVICE",
"hospital_list" : {
"hospitals" : [ "LIFECARE", "HEALPOINT" ]
},
"start_time" : "2024-03-29T16:26:01.141238759Z",
"stop_time" : "2024-03-29T16:26:01.141332438Z"
}curl --location 'http://localhost:8088/api/queries' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk' \
--data '{
"query_type" : "COUNT",
"device_type" : "PORTABLE_DEVICE",
"hospital_list" : {
"hospitals" : [ "LIFECARE", "HEALPOINT" ]
},
"start_time" : "2024-03-29T16:26:01.141238759Z",
"stop_time" : "2024-03-29T16:26:01.141332438Z"
}'200 OK
{
"result": 3
}POST http://localhost:8088/api/queries
| Header | Value |
|---|---|
| Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk |
{
"query_type" : "COUNT_ALL",
"device_type" : "PORTABLE_DEVICE",
"hospital_list" : {
"hospitals" : [ "LIFECARE" ]
},
"start_time" : "2024-03-29T16:26:01.141238759Z",
"stop_time" : "2024-03-29T16:26:01.141332438Z",
"field": "medical_speciality"
}curl --location 'http://localhost:8088/api/queries' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMSIsInJvbGUiOiJyZXNlYXJjaGVyIn0.l-K2Bh-XtvtlTBsvn-2lRZxV6nGqjO8PuxRpiFH0Bhk' \
--data '{
"query_type" : "COUNT_ALL",
"device_type" : "PORTABLE_DEVICE",
"hospital_list" : {
"hospitals" : [ "LIFECARE" ]
},
"start_time" : "2024-03-29T16:26:01.141238759Z",
"stop_time" : "2024-03-29T16:26:01.141332438Z",
"field": "medical_speciality"
}'200 OK
{
"result": {}
}