Skip to main content

users/{userid} (GET) (TCS)

Overview

Retrieve information about a user.

  • REST Method: GET
  • Method Access: public

Uri Parameters

Name Type Description
userid string Either an integer user ID, "current", or "=" followed by a double uri-encoded user name

Query Parameters

Name Type Description
exclude string? Elements to exclude from response document (choice of "groups", "properties"; default: exclude nothing)
authenticate bool? Force authentication for request (default: false)

Return Codes

Name Value Description
OK 200 The request completed successfully
Bad Request 400 Invalid input parameter or request body
Forbidden 403 Read access is required
Not Found 404 Requested user could not be found

Message Format

Output: 

<user id="{int}" href="{uri}">
    <nick>{text}</nick> 
    <username>{text}</username> 
    <email>{text}</email> 
    <page.home id="{int}" href="{int}">
        <title>{text}</title> 
        <path>{text}</path> 
    </page.home>
    <fullname /> 
    <status>{active|inactive}</status> 
    <date.lastlogin>{date}</date.lastlogin> 
    <service.authentication id="{int}" href="{uri]" /> 
    <permissions.user>
        <operations mask="{int}">{text}</operations> 
        <role id="{int}" href="{uri}">{text}</role> 
    </permissions.user>
    <permissions.effective>
        <operations mask="{int}">{text}</operations> 
    </permissions.effective>
    <groups count="{int}" href="{uri}">  
        <group id="{int}" href="{uri}">  
            <name>{text}</name>   
            <service.authentication id="{int}" href="{uri}" />   
            <users count="{int}" href="{uri}" />   
            <permissions.group>  
                <operations mask="{int}">{text}</operations>   
                <role id="{int}" href="{uri}">{text}</role>   
            </permissions.group>  
        </group>  
    ...
    </groups> 
</user>

Implementation Notes

User POST:users to add or modify users.

C# Code Sample: Retrieve User Info

The following code example retrieves the current user:

Sample Code

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
p.At("users", "current").Get();

Sample Response from executing Code

Sample response with information about the current user, Admin:

<user id="1" href="http://deki-hayes/@api/deki/users/1">
    <nick>Admin</nick>
    <username>Admin</username>
    <email>admin@mindtouch.com</email>
    <page.home id="30" href="http://deki-hayes/@api/deki/pages/30">
        <title>User:Admin</title>
        <path>User:Admin</path>
    </page.home>
    <fullname></fullname>
    <status>active</status>
    <date.lastlogin>2007-08-30T17:26:32Z</date.lastlogin>
    <service.authentication id="1" href="http://deki-hayes/@api/deki/site/services/1" />
    <permissions.user>
        <operations mask="9223372036854779903">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS,CONTROLPANEL,ADMIN</operations>
        <role id="5" href="http://deki-hayes/@api/deki/site/roles/5">Admin</role>
    </permissions.user>
    <permissions.effective>
        <operations mask="9223372036854779903">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS,CONTROLPANEL,ADMIN</operations>
    </permissions.effective>
    <groups />
</user>

Curl Code Sample: Retrieve User Info

The following command retrieves information about specific user "foo":

Sample Code

curl -u username:password -i http://mindtouch.address/@api/deki/users/=foo

Sample Response from executing Code

Response from retrieving "Admin" user data:

Content-Type: application/xml

<user id="1" href="http://192.168.59.128/@api/deki/users/1">
  <nick>Admin</nick>
  <username>Admin</username>
  <email hidden="true"/>
  <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email>
  <uri.gravatar>http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar>
  <date.created>0001-01-01T00:00:00Z</date.created>
  <page.home id="37" href="http://192.168.59.128/@api/deki/pages/37?redirects=0">
    <uri.ui>http://192.168.59.128/User:Admin</uri.ui>
    <title>User:Admin</title>
    <path>User:Admin</path>
    <namespace>user</namespace>
  </page.home>
  <fullname/>
  <status>active</status>
  <date.lastlogin>2010-02-02T19:44:00Z</date.lastlogin>
  <language/>
  <timezone/>
  <service.authentication id="1" href="http://192.168.59.128/@api/deki/site/services/1"/>
  <permissions.user>
    <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.user>
  <permissions.effective>
    <operations mask="9223372036854779903">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS,CONTROLPANEL,ADMIN</operations>
  </permissions.effective>
  <groups/>
  <properties href="http://192.168.59.128/@api/deki/users/1/properties"/>
</user>

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?