I\'m trying to ensure some users automatically via REST API. My REST call:
$.ajax({
url: \"blablabla/_api/web/ensureuser\",
type: \"POST\",
data: \"{ \'logon
ALTERNATIVE SOLUTION:
You could also perform a REST query in the following way:
$.ajax({
url: "http://[website]/_api/web/ensureuser('"+user_name+"')",
type: "POST",
headers: {
'accept': 'application/json;odata=verbose;charset=utf-8',
'Content-Type': 'application/json;odata=verbose;charset=utf-8',
'X-RequestDigest': $("#__REQUESTDIGEST").val()
},
success: function(response_data){ [your custom success action]
},
error: function(response_data){[your custom fail action]}
});
var user_name will contain target AD username.
NOTE:
When using the ensureUser method against an AD user, just use its username. So, user_name would be something like this: "username". No need to add "domain\" before neither any other kind of prefix/suffix. Just the username
ContentType & accept headers MUST be application/json;odata=verbose;charset=utf-8