users/{userid}/properties/{key} (GET)
Overview
Retrieve the content of a user property
- REST Method: GET
- Method Access: public
Uri Parameters
Name | Type | Description |
key | string | A unique identifier for a property that is obtained through GET:users/{userid}/properties |
userid | string | either an integer user ID, "current", or "=" followed by a double uri-encoded user name |
Query Parameters
Name | Type | Description |
authenticate | bool? | Force authentication for request (default: false) |
redirects | int? | If zero, do not follow page redirects. |
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 and/or property could not be found |
Message Format
Response is the etag, content-length, content-type, and body of the property.
Implementation Notes
- A user may only read their own properties. Admins can read anyones users properties.
C# Code Sample: Retrieve a User Property Value
The following code authenticates and retrieves the value of a user property named 'foo'
Sample Code
Plug p = Plug.New("http://devwiki/@api/deki"); p.At("users", "authenticate") .WithCredentials("sysop", "password").Get(); string val = p.At("users", "current", "properties", "foo") .Get().AsText()
Curl Code Sample: Retrieve a User Property Value
The following command retrieves and returns the value of user property "foo" associated to user "bar":
Sample Code
curl -u admin:password -i http://mindtouch.address/@api/deki/users/=bar/properties/foo
Sample Response from executing Code
Example of retrieving the contents of the user property listed here:
Content-Type: text/plain
bar
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.
Response
- Note that a property value can contain non-text data types. So if an image file for example is assigned as the property's value, a bunch of junk will very possibly be outputted to console unless redirected.
User Properties
- To view a list of a user's properties, follow the instructions here.