...
- Provide a function to GET settings data by username
- Provide a function to POST / (PUT / PATCH?) settings data for a specific user
- Provide a function to DELETE settings data of a specific user
Restriction:
- username must be uniqueno clear payload data structure definition to keep it as flexible as possible => what is written, can be requested
Characteristics:
- user gets identified by token (basicAuth or JWT)
- Additional API on "/in bundle data-provider:userdata"
- Create a settings entry in the database if none exists
- Delivers back all settings of a user
- Updates the settings of a user
- Can delete (reset) settings of a user
...
- when should the initial settings entry of a user be created? When settings are updated / saved for the first time?
- UI is responsible for data-structure → so initial data is writting by UI
- Use PUT or PATCH for updating entries? (settings may grow over time, eg. dashboard, networkmap, ...) Should the entire settings object be send or only a partial one?
- PUT!
- partial will be implemented
- If we use PUT, do we need POST?
- no
- Should settings be queryable by section? ( eg. dashboard, networkmap, ...)
- filter only for root element key
Extension of data-provider
Operation | Expected result | ||
---|---|---|---|
GET /data-provider:userdata/{username} | Gets all the settings of a specified userPOST | ||
GET / | data-provider:userdata/{ | usernamekey} | Creates a settings entry for a specifiedGets the subsettings of a spefic user for rootElem[key] |
PUT /userdata | Creates/Updates settings entry of a user | ||
PUT / | data-provider:userdata/{ | usernamekey} | Creates/Updates settings entry of a user for rootElem[key] |
DELETE /userdata | Deletes settings entry of a user | ||
DELETE / | data-provider:userdata/{ | usernamekey} | Deletes settings entry of a user |
...
for rootElem[key] |
Examples
Read settings data of a user
GET /userdata
Code Block |
---|
{
"networkMap":{
"startupPosition": {"lat": 52.5095, "lon":13.3290, "zoom": 10},
"tileOpacity": 90,
"styling":{
"theme": "light"
}
},
"dashboard":{
}
} |
GET /userdata/networkMap
Code Block |
---|
{
"startupPosition": {"lat": 52.5095, "lon":13.3290, "zoom": 10},
"tileOpacity": 90,
"styling":{
"theme": "light"
}
} |
Write settings data of a user
PUT /userdata
Code Block |
---|
{
"networkMap":{
"startupPosition": {"lat": 52.5095, "lon":13.3290, "zoom": 10},
"tileOpacity": 90,
"styling":{
"theme": "light"
}
}
} |
PUT /userdata/networkMap
Code Block |
---|
{
"startupPosition": {"lat": 52.5095, "lon":13.3290, "zoom": 10},
"tileOpacity": 90,
"styling":{
"theme": "light"
}
} |
Note: settings data currently subject to change, note will be deleted once finalized