getRoles()

Pixelsilk API function to get the site roles--requires the access-users or edit-page-properties permission
Parameters:
The function getRoles has no parameters.

Output:
The function getRoles returns an enumerable collection of the site's roles

C# Example:
IEnumerable roles = GetRoles();
Note the capital first letter of the C# method.

HTTP Example:
Request Headers:
POST /api2/getRoles HTTP/1.1
HOST: www.example.com
Content-Length: 36
Content-Type: application/x-www-form-urlencoded
Cookie: auth=050574E18F4C...DB0B31C47C6E

Request Data:
Unencoded Data:
token=7AdbNHZQBtwc...RPTEK8UvSUQ=

Url-encoded Data:
token=7AdbNHZQBtwc...TEK8UvSUQ%3d

Response Headers:
HTTP/1.1 200 OK
Set-Cookie: auth=F3A85E0BDE0A...741B1D57FE1; path=/
Content-Type: text/javascript; charset=UTF-8
Content-Length: 1516

Response Data:
[
  {
    "id":"28702460-372d-4815-a594-92b9864b1085",
    "name":"Administrators",
    "description":"Site Administrators",
    "isSystemRole":true,
    "isHidden":false,
    "adminAccess":[
      "on",
      "add-page",
      "delete-page",
      "move-page",
      "edit-page-properties",
      "add-skin",
      "edit-skin",
      "delete-skin",
      "add-search-advice",
      "edit-search-advice",
      "view-search-advice",
      "access-users",
      "access-libraries",
      "advanced-admin-access",
      "may-moderate-site-changes",
      "authorized-contact"
    ]
  },
  {
    "id":"728a9c66-9c50-49a7-a260-501d1ac62763",
    "name":"Ed",
    "description":"",
    "isSystemRole":false,
    "isHidden":false,
    "adminAccess":[
      "edit-page-properties"
    ]
  },
  {
    "id":"4a364070-b45a-4e18-9587-ff65b941e401",
    "name":"SecurityTest",
    "description":"For testing API and admin security ew",
    "isSystemRole":false,
    "isHidden":false,
    "adminAccess":[
      "add-page",
      "delete-page",
      "move-page",
      "edit-page-properties"
    ]
  }
]
Note: most of the roles have been removed for better readability.

JavaScript Example:
Method Call:
pixelsilk2.getRoles(callback);

Input Object:
The function getRoles has no parameters.

Returned Data:
[
    {
        "id":"eb248f84-e617-4b18-a22e-433d9118a1c5",
        "name":"Administrators",
        "description":"Site Administrators",
        "isSystemRole":false,
        "isHidden":false,
        "adminAccess":[
            "on",
            "add-page",
            "delete-page",
            "move-page",
            "edit-page-properties",
            "add-skin",
            "edit-skin",
            "delete-skin",
            "add-search-advice",
            "edit-search-advice",
            "view-search-advice",
            "access-users",
            "access-libraries",
            "advanced-admin-access",
            "may-moderate-site-changes",
            "authorized-contact",
            "allow-scripts"
        ]
    },
    {
        "id":"e156538c-5300-4d92-98a8-a20cdd9d1add",
        "name":"EditorTest",
        "description":"Role for testing",
        "isSystemRole":false,
        "isHidden":false,
        "adminAccess":[
            "add-page",
            "delete-page",
            "move-page",
            "edit-page-properties"
        ]
    }
]
NOTE: many roles have been removed to make this easier to read.

Back to Users »