Custom User Settings


#1

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).

Cheers!


How to use iOS SDK SWGCustomSettings to set Custom Values
How to use iOS SDK SWGCustomSettings to set Custom Values
#2

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:

DELETE /rest/user/custom/real_first_name

#3

Thanx Todd. That is exactly what I was hoping for :slight_smile:

Cheers!


#4

Can I access as admin, to the custom user settings of any user ?


#5

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.

GET /rest/system/user?fields=user_data

#6

I moved a post to an existing topic: How to use iOS SDK SWGCustomSettings to set Custom Values


#7

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.”

(No problem with setting 1)


#8

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.