03-26-2009 10:31 AM
Memberships
Adds a new membership to the site.
POST /alfresco/service/api/sites/{shortname}/memberships
Requirements:
* Default Format: json
* Authentication: user
* Transaction: required
* Format Style: any
Definition:
* Id: org/alfresco/repository/site/membership/memberships.post
* Description: classpath:alfresco/templates/webscripts/org/alfresco/repository/site/membership/memberships.post.desc.xml
method = "post";
path = "/alfresco/service/api/sites/test/memberships";
params = '{"site" : "test","role" : "SiteManager","person" : {"userName" : "fName.lName","firstName" : "fName","lastName" : "lName"}}'
var formA = document.createElement("form");
formA.setAttribute("method", method);
formA.setAttribute("action", path);
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
// hiddenField.setAttribute("name", key);
hiddenField.setAttribute("value", params);
formA.appendChild(hiddenField);
document.body.appendChild(formA); // Not entirely sure if this is necessary
formA.submit();
03-26-2009 10:35 AM
03-26-2009 11:16 AM
{"person":{"userName":"first.last"},"role":"SiteContributor"}03-26-2009 11:57 AM
var url = "/alfresco/service/api/sites/test/memberships";
var params = '{"person":{"userName":"someValidUserName"},"role":"SiteContributor"}';
var http = new XMLHttpRequest();
http.open("POST", url, true);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/json");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(params);03-26-2009 12:24 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.