users/{userid}/properties (GET)
Overview
Retrieve the properties associated with 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 |
redirects | int? | If zero, do not follow page redirects. |
names | string? | Comma separated list of names of properties to return. The entire value should be URI encoded including the commas. Use '*' at the start or end of a name for wildcard matches. Default: all properties |
contentcutoff | int? | Only show property content shorter than this number of bytes. Default: 2048 |
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 | ADMIN access is required to access other user's properties |
Not Found | 404 | Requested user could not be found |
Message Format
Response is a list of the standard property xml blocks.
<properties count="{int}" href="{uri}"> <property name="{text}" href="{uri}" etag="{text}"> <contents type="{text}" href="{uri}">{text}</contents> <date.modified>{date}</date.modified> <user.modified id="{int}" href="{uri}"> <nick>{text}</nick> <username>{text}</username> </user.modified> <change-description>{text}</change-description> </property> </properties>
Implementation Notes
- A user may only read their own properties. Admins can read anyones users properties.
C# Code Sample: Retrieve User Properties
The following code authenticates and retrieves all properties belonging to the sysop user.
Sample Code
Plug p = Plug.New("http://devwiki/@api/deki"); p.At("users", "authenticate") .WithCredentials("sysop", "password").Get(); XDoc props = p.At("users", "current", "properties") .Get().AsDocument()
Sample Response from executing Code
<properties count="1" href="http://devwiki/@api/deki/users/1/properties"> <property name="myprop" href="http://devwiki/@api/deki/users/1/properties/myprop/info" etag="4465.r2_ts2009-03-20T23:52:50Z"> <contents type="text/plain" href="http://devwiki/@api/deki/users/1/properties/myprop">new value for property</contents> <date.modified>2009-03-20T23:52:50Z</date.modified> <user.modified id="1" href="http://devwiki/@api/deki/users/1"> <nick>Sysop</nick> <username>Sysop</username> </user.modified> <change-description>description of change</change-description> </property> </properties>
Curl Code Sample: Retrieve User Properties
The following command retrieves a list of all user properties associated with user "foo:
Sample Code
curl -u username:password -i http://mindtouch.address/@api/deki/users/=foo/properties
Sample Response from executing Code
Data returned for a user with 1 associated property:
Content-Type: application/xml
<properties count="1" href="http://192.168.59.128/@api/deki/users/88/properties"> <property name="foo" href="http://192.168.59.128/@api/deki/users/88/properties/foo/info" etag="116.r1_ts2010-02-02T22:47:40Z"> <contents type="text/plain" size="3" href="http://192.168.59.128/@api/deki/users/88/properties/foo">bar</contents> <date.modified>2010-02-02T22:47:40Z</date.modified> <user.modified id="1" href="http://192.168.59.128/@api/deki/users/1"> <nick>Admin</nick> <username>Admin</username> <email>admin@admin.com</email> <hash.email>64e1b8d34f425d19e1ee2ea7236d3028</hash.email> <uri.gravatar>http://www.gravatar.com/avatar/64e1b8d34f425d19e1ee2ea7236d3028</uri.gravatar> </user.modified> <change-description/> </property> </properties>
Implementation notes
curl flags
- -u
- Provides external user authentication.
- -i
- Outputs the HTTP response headers. Useful for debugging.
Permissions
- ADMIN permission is required to execute above command unless an authenticated user performs a property list request on themselves.
Users
- To view a list of all users, follow the instructions here.