addRole()

Pixelsilk API function to add a new role--requires the access-users permission
Parameters:
name: the name of the new role
description: the desciption of the new role
isHidden: true = is hidden; false = is not hidden
isSystemRole: true = is system role; false = not a system role
adminAccess: collection of admin access permissions

Output:
The function addRole returns void.

C# Example:
string name = "nameOfNewRole";
string description = "descriptionOfNewRole";
string isHidden = "false";
string isSystemRole = "false";
string[] adminAccess = {advanced-admin-access, access-libraries};
AddRole(name, description, isHidden, isSystemRole, adminAccess);
Note the capital first letter of the C# method.

HTTP Example:
Request Headers:
POST /api2/addRole HTTP/1.1
HOST: www.example.com
Content-Length: 310
Content-Type: application/x-www-form-urlencoded
Cookie: auth=F62E595AD904...CD02948AE171

Request Data:
Unencoded Data:
json={
   "name":"Exemplar",
   "description":"example role",
   "isHidden":"false",
   "isSystemRole":"false",
   "adminAccess":[
      "advanced-admin-access"
   ]
}&token=7AdbNHZQBtwc...RPTEK8UvSUQ=

Url-encoded Data:
json=%7b%0d%0a+++...%5d%0d%0a%7d&token=7AdbNHZQBtwc...TEK8UvSUQ%3d

Response Headers:
HTTP/1.1 200 OK
Set-Cookie: auth=0F8F23D7A00B...08BC5704D48; path=/
Content-Type: text/javascript; charset=UTF-8
Content-Length: 2

Response Data:
{}

JavaScript Example:
Method Call:
pixelsilk2.addRole(input, callback);

Input Object:
{
    "name":"Devon",
    "description":"developer",
    "isHidden":false,
    "isSystemRole":false,
    "adminAccess":[
        "advanced-admin-access"
    ]
}

Returned Data:
{}

Back to Users »