osm_get_preferences_user {osmapiR} | R Documentation |
Get or set preferences for the logged-in user
Description
Get or set preferences for the logged-in user
Usage
osm_get_preferences_user(key, format = c("R", "xml", "json"))
osm_set_preferences_user(key, value, all_prefs)
Arguments
key |
Returns a string with this preference's value. If missing, return all preferences. |
format |
Format of the output. Can be |
value |
A string with the preference value to set for |
all_prefs |
A |
Details
The sizes of the key and value are limited to 255 characters.
The OSM server supports storing arbitrary user preferences. This can be used by editors, for example, to offer the same configuration wherever the user logs in, instead of a locally-stored configuration. For an overview of applications using the preferences-API and which key-schemes they use, see this wiki page.
Value
If format = "R"
, returns a data frame with key
and value
columns of the user preferences.
format = "xml"
Returns a xml2::xml_document with the following format:
<osm version="0.6" generator="OpenStreetMap server"> <preferences> <preference k="somekey" v="somevalue" /> ... </preferences> </osm>
format = "json"
Returns a list with the following json structure:
{ "version": "0.6", "generator": "OpenStreetMap server", "preferences": {"somekey": "somevalue, ...} }
Set preferences
Nothing is returned upon successful setting of user preferences.
See Also
Other users' functions:
osm_details_logged_user()
,
osm_get_user_details()
Examples
## Not run:
prefs_ori <- osm_get_preferences_user()
prefs_ori
osm_set_preferences_user(key = "osmapiR-test", value = "good!")
osm_get_preferences_user(key = "osmapiR-test")
osm_set_preferences_user(key = "osmapiR-test", value = NULL) # Delete pref
## Restore all preferences
osm_set_preferences_user(all_prefs = prefs_ori)
## End(Not run)