REST API endpoints for user information
Last modified by Pierre Jeanjean on 2026/03/23 17:04
- XWiki
- Feature
- Completed
- Yes
Description
Requirements
- Obtain public user information of a given user, such as display name, email address and avatar,
- Access user preferences if visible (i.e., logged-in user access their own preferences, or are an administrator),
- Quick access to user information and preferences for the currently logged-in user.
Definition
Model
<complexType name="UserSummary">
<complexContent>
<extension base="xwiki:LinkCollection">
<sequence>
<element name="id" type="string"></element>
<element name="firstName" type="string"></element>
<element name="lastName" type="string"></element>
<element name="avatarUrl" type="string"></element>
<element name="global" type="boolean"></element>
<element name="xwikiRelativeUrl" type="string"></element>
<element name="xwikiAbsoluteUrl" type="string"></element>
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="UserPreferences">
<sequence>
<element name="displayHiddenDocuments" type="boolean"></element>
<element name="underlineLinks" type="string"></element>
<element name="timezone" type="string"></element>
<element name="editor" type="string"></element>
<element name="advanced" type="boolean"></element>
</sequence>
</complexType>
<complexType name="User">
<complexContent>
<extension base="xwiki:UserSummary">
<sequence>
<element name="displayName" type="string"></element>
<element name="company" type="string"></element>
<element name="about" type="string"></element>
<element name="email" type="string"></element>
<element name="phone" type="string"></element>
<element name="address" type="string"></element>
<element name="blog" type="string"></element>
<element name="blogFeed" type="string"></element>
<element name="preferences" type="xwiki:UserPreferences" minOccurs="0"></element>
</sequence>
</extension>
</complexContent>
</complexType>
<element name="users">
<complexType>
<sequence>
<element name="userSummary" type="xwiki:UserSummary" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
</complexType>
</element>
<element name="user" type="xwiki:User"></element>Endpoints
All the endpoints go through a specific wiki, which is necessary to authenticate the user in a wiki before performing the request.
/wikis/{wikiName}/user[?preferences={true,false}]
- HTTP Method: GET
- Media types:
- application/xml (User element)
- Query parameters:
- preferences: also return the preferences. Disabled by default.
- Description: The user performing the request
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized on {wikiName}.
- Media types:
/wikis/{wikiName}/users/{userId}[?preferences={true,false}]
- HTTP Method: GET
- Media types:
- application/xml (User element)
- Query parameters:
- preferences: also return the preferences. Disabled by default and might require specific rights.
- Description: The user that corresponds to {userId} when resolved from {wikiName}. The format of {userId} is intentionally left unspecified and depends on the available resolvers on the instance. For example, with a user stored as a document XWiki.someUser on the default wiki, {userId} could be either someUser or one of the more technical syntaxes listed in the User API documentation.
- Status codes:
- 200: If the request was successful.
- 401: If the user is not authorized on {wikiName} or does not have access to the requested user's profile.
- 404: If the requested user could not be found.
- Media types:
Pierre Jeanjean