Skip to main content

site/roles (GET) (MT4)

Overview

Retrieve list of defined roles

  • REST Method: GET
  • Method Access: public

Query Parameters

Name Type Description
authenticate bool? Force authentication for request (default: false)

Return Codes

Name Value Description
OK 200 The request completed successfully

Message Format

Output:

<roles>
    <permissions>
        <operations mask="{int}">{text}</operations> 
        <role id="{int}" href="{uri}">{text}</role> 
    </permissions>
    ...
</roles>

Implementation Notes

Use GET:site/operations to retrieve a list of all operations currently defined on the site. 

C# Code Sample: Retrieve Rolse List

The following code example retrieves a list of roles currently defined on the site:

Sample Code

Plug p = Plug.New("http://help.mindtouch.us/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
p.At("site", "roles").Get();

Sample Response from executing Code

<roles href="http://help.mindtouch.us/@api/deki/site/roles">
    <permissions>
        <operations mask="0" /> 
        <role id="1" href="http://help.mindtouch.us/@api/deki/site/roles/1">None</role> 
    </permissions>
    <permissions>
        <operations mask="1">LOGIN</operations> 
        <role id="2" href="http://help.mindtouch.us/@api/deki/site/roles/2">Guest</role> 
    </permissions>
    <permissions>
        <operations mask="15">LOGIN,BROWSE,READ,SUBSCRIBE</operations> 
        <role id="3" href="http://help.mindtouch.us/@api/deki/site/roles/3">Viewer</role> 
    </permissions>
    <permissions>
        <operations mask="1343">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS</operations> 
        <role id="4" href="http://help.mindtouch.us/@api/deki/site/roles/4">Contributor</role> 
    </permissions>
    <permissions>
        <operations mask="9223372036854779903">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS,CONTROLPANEL,ADMIN</operations> 
        <role id="5" href="http://help.mindtouch.us/@api/deki/site/roles/5">Admin</role> 
    </permissions>
</roles>

Implementation notes 

Add notes about requirements or config values

Curl Code Sample: Retrieve Rolse List

The following command retrieves a list of all existing roles:

Sample Code

curl -u username:password -i http://mindtouch.address/@api/deki/site/roles

Sample Response from executing Code

The following is a list of roles packaged with MindTouch and a user defined role.

Content-Type: application/xml

<roles href="http://192.168.59.128/@api/deki/site/roles">
  <permissions>
    <operations mask="0"/>
    <role id="1" href="http://192.168.59.128/@api/deki/site/roles/1">None</role>
  </permissions>
  <permissions>
    <operations mask="1">LOGIN</operations>
    <role id="2" href="http://192.168.59.128/@api/deki/site/roles/2">Guest</role>
  </permissions>
  <permissions>
    <operations mask="15">LOGIN,BROWSE,READ,SUBSCRIBE</operations>
    <role id="3" href="http://192.168.59.128/@api/deki/site/roles/3">Viewer</role>
  </permissions>
  <permissions>
    <operations mask="1343">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS</operations>
    <role id="4" href="http://192.168.59.128/@api/deki/site/roles/4">Contributor</role>
  </permissions>
  <permissions>
    <operations mask="9223372036854779903">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS,CONTROLPANEL,ADMIN</operations>
    <role id="5" href="http://192.168.59.128/@api/deki/site/roles/5">Admin</role>
  </permissions>
  <permissions>
    <operations mask="4">READ</operations>
    <role id="6" href="http://192.168.59.128/@api/deki/site/roles/6">0b364cd813bb4db9a41dea219c29f517</role>
  </permissions>
  ...
</roles>

Implementation notes 

curl flags

-u
Provides external user authentication. Note that if anonymous access is available and authentication is not forced, this flag may be omitted.
-i
Outputs the HTTP response headers. Useful for debugging.
  • Was this article helpful?