cblown
12 years agoBoss
Lithium Custom Settings - Unable to SET as user
We have a custom setting called user.data (Lithium have setup for us) that is scoped to wcu (world, community, user).
We are trying to SET this custom setting using AJAX - the user account has GRANT for Make REST API calls with modify access
Code
<@liaAddScript> ;(function($) { $.post("/restapi/vc/users/self/settings/name/user.data/set", {value: "my user data"}).done(function(data) { alert(data); }).fail(function() { alert("error"); }).always(function() { alert("finished"); }); })(LITHIUM.jQuery); </@liaAddScript>
Response
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <response status="error"> <error code="303"> <message> User[uid=2369] cannot set field 'user.data' on object User[uid=2369] </message> </error> </response>
I'm not sure, but I would try to use a custom user profile instead of settings.
I did a quick test and the code works fine in that case, the call would be something like:$.post("/restapi/vc/users/self/profiles/name/user.data/set", {value: "my user data"})
Check with Lithium support if they can change the current definition to a "profile" one...