Save user setting return error 100
Hi,
I want to save the user first_name value using the rest api but when I make the ajax call I got error 100 (Unknown error occured). So I can not save the value. I read the documentation but could not find a solution for this. I am doing the following:
Call the rest api the following way:
var apiURL = '/restapi/vc/authentication/sessions/current/user/profiles/name/first_name/set?restapi.response_format=json';
$.ajax({
method: "POST",
url: apiURL,
data: { value: val }
})
.done(function(response) {
apiCallHandleResponse(response.response);
});Then I got the following response:
{"response":{"status":"error","error":{"code":100,"message":"Ein unerwarteter Fehler ist aufgetreten."}}}
I am logged in as a user. I am not doing any authentication cause I am logged in a user already. But when I am doing an AjaxCall I need to authenticate, or am I wrong? Is there any full documentation or an example about saving user settings with ajax?
Regards,
Michael
PaoloT good point ;)
In that case, the error 100 might come from the settings name (name_first and not first_name)
Instead of
var apiURL = '/restapi/vc/authentication/sessions/current/user/profiles/name/first_name/set?restapi.response_format=json';
Use
var apiURL = '/restapi/vc/authentication/sessions/current/user/profiles/name/name_first/set?restapi.response_format=json';
Also, I believe it's worth checking if the following call:
https://<your_community_url>/restapi/vc/users/self/profiles
return a value for name_first as this example:
<profile name="name_first" type="string">Olivier</profile>
Which I don't think it does on your community micha80 (I will reach out to you by email)