AnsweredAssumed Answered

Create a person using restAPI

Question asked by jackarnd on Jun 7, 2017
Latest reply on Jun 9, 2017 by jackarnd

Hello !

 

So I want to create a person using the RESTApi but I really don't know how to do it.

For the moment I did that (it's on a custom share page, hence I used the share proxy as you can see below) :

var boby = "{ \"id\": \"bob\",\"firstName\": \"Bob\", \"lastName\": \"LeBricoleur\", \"email\": \"bob@lebricoleur.com\", \"telephone\": \"6666666666\", \"enabled\": true,\"emailNotificationsEnabled\": true, \"password\": \"bob\" }";
console.log(boby);
function loadDoc() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("creatingperson").innerHTML = this.responseText;
}
};
xhttp.open("POST", 'http://localhost:8081/share/proxy/alfresco-api/-default-/public/alfresco/versions/1/people', true);
xhttp.setRequestHeader("Content-Type", "application/json"); //--header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic YWRtaW46YWRtaW4='
xhttp.send(boby);
}

But this doesn't do anything, it doesn't even give me response..
I also can't find a generic way to extract data from Alfresco so if anyone knows where is the doc about it..
Thanks in advance !

Outcomes