I am just wondering what the “Custom User Settings” in REST API are for (and mostly how to use them). I can’t find an example anywhere. setCustomSettings(), getCustomSettings(), etc. I was hoping to add a few fields in User (otherwise I will have to do user management in SQL tables).
Each user has their own custom settings consisting of name-value pairs. The REST API allows you to access these settings for the currently logged in user. For example you can create some custom settings like this:
POST /rest/user/custom with POST data = {"real_first_name":"Bob","real_last_name":"Smith"}
Now you can get all settings for the current user:
GET /rest/user/custom
Or get a single setting for the current user:
GET /rest/user/custom/real_first_name
You can update or add a single setting for the current user:
POST /rest/user/custom with POST data = {"real_first_name":"Joe"}
You can also delete settings but only one at a time:
Yes. User settings are not exposed in the admin console, but they are available to admin users (or other users with role access to /system/user) via the API.
My custom settings are:
{
“0”: 0,
“1”: 0,
}
When I attempt delete the first setting from DF live API (0) I get the error message:“Deleting all custom settings is not currently supported.”
You cannot have custom user settings with numerical field names (even numbers in quotes, e.g. “15”). This is a limitation that applies to 1.x only. In DreamFactory 2.0, the ability to name custom user settings with numbers or numerical strings is added.