Admin REST API Create User 406 ERROR Not Acceptable
BeantwortetHi,
I am trying to create a user with the Admin REST Api, but getting "406 ERROR Not Acceptable"
I have tested GET and DELETE and I have no problem here.
What am I missing?
Here is my code:
var createUser = function createUser(companyId, token) {
varrequest= {
"companyId": companyId,
"loginEmail": "rbwtest1@amillan.co.uk",
"password": "Rbwtest1!",
"firstName": "John",
"lastName": "Doe",
"nickName": "",
"title": "Mr",
"jobTitle": "Bot",
"emails": [
{
"email": "rbwtest1@amillan.co.uk",
"type": "work"
}
],
"phoneNumbers": [
{
"number": "01234567891",
"country": "GBR",
"type": "Work",
"deviceType": "landline"
}
],
"country": "GBR",
"language": "en",
"timezone": "Europe/London",
"accountType": "free",
"roles": "user",
"adminType": "company_admin",
"isActive": "true",
"isInitialized": "false",
"visibility": "private",
"timeToLive": 0
}
console.log("request: "+JSON.stringify(request));
console.log("[DEMO] :: Try to create user using the token received", companyId);
returnnewPromise(function(resolve, reject) {
varsearchURL="/api/rainbow/admin/v1.0/users"
$.ajax({
url: protocol + host + ":" + port + searchURL,
method: "POST",
headers: {
"Authorization": "Bearer "+token,
"Accept": "application/json"
},
data:JSON.stringify(request)
}).done(function(data, textStatus, jqXHR) {
console.log("[DEMO] :: User creation success", data);
resolve(data);
}).fail(function(jqXHR, textStatus, errorThrown) {
console.log("[DEMO] :: User creation failed", errorThrown);
reject(errorThrown);
});
});
};
createUser(data.companyId, getToken("token")).then(function(data) {
console.log("User created", data);
}).catch(function(err) {
console.log("ERROR", err);
});
Regards,
Esben
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar