Users
The Users API has methods for managing users.
Create user
Create a user account.
POST /api/users
Body parameters
uid
string requiredA unique user identifier (cannot contain whitespace and must contain at least one non-digit).
username
stringUsername. Must be unique if/when specified.
email
stringEmail address. Must be unique if/when specified.
given_name
stringGiven/First name(s) of user. In some cultures, people can have multiple given names; all can be present, with the names being separated by space characters.
middle_name
stringMiddle name(s) of the user. In some cultures, people can have multiple middle names; all can be present, with the names being separated by space characters.
name
stringThe full name in displayable form including all name parts, possibly including titles and suffixes.
family_name
stringFamily/Last name(s) of user. In some cultures, people can have multiple family names or no family name; all can be present, with the names being separated by space characters.
nickname
stringThe nickname, a casual name that may or may not be the same as the Weavy.Core.DTO.ProfileUp.GivenName. For instance, a person with given name "Michael" might have the nickname "Mike".
phone_number
stringThe user's preferred phone number.
comment
stringComment or other application-specific information about the user.
picture
stringThe user's profile picture. Can be a public URL, a base-64 encoded image or a blob id.
directory
stringId or name of user directory.
metadata
objectAdditional metadata properties, e.g.
{ "color": "blue", "size": "XL" }
.
tags
array of stringsA list of tags to associate with the user.
is_suspended
booleantrue
to mark the user account as suspended, otherwisefalse
.
Response codes
201 Created
{
"id": "integer",
"uid": "string",
"display_name": "string",
"username": "string",
"email": "string",
"given_name": "string",
"middle_name": "string",
"name": "string",
"family_name": "string",
"nickname": "string",
"phone_number": "string",
"comment": "string",
"directory_id": "integer",
"picture_id": "integer",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
400 Bad Request
Code sample
curl https://{WEAVY-SERVER}/api/users
-H "Authorization: Bearer {API-KEY}"
-H "Content-Type: application/json"
-d "{ 'uid': 'user-1', 'name': 'John Doe', 'directory': 'acme' }"
List users
List users.
GET /api/users
Query parameters
directory_id
integerList users in the specified directory,
null
lists users from all directories.
suspended
booleanIndicates whether to list suspended users or not.
q
stringA query used to find matching items.
tag
stringList items with the specified tag.
trashed
booleanIndicates whether trashed items should be listed (default is
false
). Specifynull
to return both trashed and non-trashed items.
order_by
stringSpecifies the sort order and direction for the listing, e.g. "
name
" or "name+desc
"
top
integerMaximum number of items to return in the listing. Should be a value between
0
and100
. Default is25
.
skip
integerThe number of items to skip. Used together with
top
to return a specific range of items (for pagination).
count
booleanfalse
to skip counting the total number of matching items; default istrue
.
count_only
booleantrue
to only return the number of matching items; when this is specified the response will only contain thecount
property.
Response codes
200 Success
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}
Code sample
curl https://{WEAVY-SERVER}/api/users?top=20
-H "Authorization: Bearer {API-KEY}"
Get user
Get a user by id.
GET /api/users/{id}
Path parameters
id
integer requiredId of user.
Query parameters
trashed
booleantrue
to return user even if trashed.
Response codes
200 Success
{
"id": "integer",
"uid": "string",
"display_name": "string",
"username": "string",
"email": "string",
"given_name": "string",
"middle_name": "string",
"name": "string",
"family_name": "string",
"nickname": "string",
"phone_number": "string",
"comment": "string",
"directory_id": "integer",
"picture_id": "integer",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Code sample
curl https://{WEAVY-SERVER}/api/users/1
-H "Authorization: Bearer {API-KEY}"
Update user
Update a user.
PATCH /api/users/{id}
Path parameters
id
integer required
Body parameters
uid
stringA string that uniquely identifies the user (cannot contain whitespace and must contain at least one non-digit).
username
stringUsername. Must be unique if/when specified.
email
stringEmail address. Must be unique if/when specified.
given_name
stringGiven/First name(s) of user. In some cultures, people can have multiple given names; all can be present, with the names being separated by space characters.
middle_name
stringMiddle name(s) of the user. In some cultures, people can have multiple middle names; all can be present, with the names being separated by space characters.
name
stringThe full name in displayable form including all name parts, possibly including titles and suffixes.
family_name
stringFamily/Last name(s) of user. In some cultures, people can have multiple family names or no family name; all can be present, with the names being separated by space characters.
nickname
stringThe nickname, a casual name that may or may not be the same as the Weavy.Core.DTO.ProfileUp.GivenName. For instance, a person with given name "Michael" might have the nickname "Mike".
phone_number
stringThe user's preferred phone number.
comment
stringComment or other application-specific information about the user.
picture
stringThe user's profile picture. Can be a public URL, a base-64 encoded image or a blob id.
directory
stringId or name of user directory.
metadata
objectAdditional metadata properties, e.g.
{ "color": "blue", "size": "XL" }
.
tags
array of stringsA list of tags to associate with the user.
is_suspended
booleantrue
to mark the user account as suspended, otherwisefalse
.
Response codes
204 No Content
404 Not Found
400 Bad Request
Code sample
$ curl -X PATCH {WEAVY_SERVER}/api/users/1
-H "Authorization: Bearer {API-KEY}"
-H "Content-Type: application/json"
-d "{ 'name': 'Updated name' }"
Get user (uid)
Get a user by uid.
GET /api/users/{uid}
Path parameters
uid
string requiredUnique user identifier.
Query parameters
trashed
booleantrue
to return user even if trashed.
Response codes
200 Success
{
"id": "integer",
"uid": "string",
"display_name": "string",
"username": "string",
"email": "string",
"given_name": "string",
"middle_name": "string",
"name": "string",
"family_name": "string",
"nickname": "string",
"phone_number": "string",
"comment": "string",
"directory_id": "integer",
"picture_id": "integer",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Code sample
curl https://{WEAVY-SERVER}/api/users/user-1
-H "Authorization: Bearer {API-KEY}"
Sync user
Create or update user with specified uid.
PUT /api/users/{uid}
Path parameters
uid
string requiredUnique user identifier.
Body parameters
username
stringUsername. Must be unique if/when specified.
email
stringEmail address. Must be unique if/when specified.
given_name
stringGiven/First name(s) of user. In some cultures, people can have multiple given names; all can be present, with the names being separated by space characters.
middle_name
stringMiddle name(s) of the user. In some cultures, people can have multiple middle names; all can be present, with the names being separated by space characters.
name
stringThe full name in displayable form including all name parts, possibly including titles and suffixes.
family_name
stringFamily/Last name(s) of user. In some cultures, people can have multiple family names or no family name; all can be present, with the names being separated by space characters.
nickname
stringThe nickname, a casual name that may or may not be the same as the Weavy.Core.DTO.ProfileUp.GivenName. For instance, a person with given name "Michael" might have the nickname "Mike".
phone_number
stringThe user's preferred phone number.
comment
stringComment or other application-specific information about the user.
picture
stringThe user's profile picture. Can be a public URL, a base-64 encoded image or a blob id.
directory
stringId or name of user directory.
metadata
objectAdditional metadata properties, e.g.
{ "color": "blue", "size": "XL" }
.
tags
array of stringsA list of tags to associate with the user.
is_suspended
booleantrue
to mark the user account as suspended, otherwisefalse
.
Response codes
200 Success
{
"id": "integer",
"uid": "string",
"display_name": "string",
"username": "string",
"email": "string",
"given_name": "string",
"middle_name": "string",
"name": "string",
"family_name": "string",
"nickname": "string",
"phone_number": "string",
"comment": "string",
"directory_id": "integer",
"picture_id": "integer",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
201 Created
{
"id": "integer",
"uid": "string",
"display_name": "string",
"username": "string",
"email": "string",
"given_name": "string",
"middle_name": "string",
"name": "string",
"family_name": "string",
"nickname": "string",
"phone_number": "string",
"comment": "string",
"directory_id": "integer",
"picture_id": "integer",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Code sample
$ curl -X PUT {WEAVY_SERVER}/api/users/user-1
-H "Authorization: Bearer {API-KEY}"
-H "Content-Type: application/json"
-d "{ 'name': 'John Doe', 'email': 'john@acme.com' }"
Get authenticated user
Get the authenticated user.
GET /api/user
Response codes
200 Success
{
"id": "integer",
"uid": "string",
"display_name": "string",
"username": "string",
"email": "string",
"given_name": "string",
"middle_name": "string",
"name": "string",
"family_name": "string",
"nickname": "string",
"phone_number": "string",
"comment": "string",
"directory_id": "integer",
"picture_id": "integer",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Code sample
curl https://{WEAVY-SERVER}/api/user
-H "Authorization: Bearer {ACCESS-TOKEN}"
Trash user
Move a user to the trash.
POST /api/users/{id}/trash
Path parameters
id
integer requiredId of the user to trash.
Response codes
200 Success
{
"id": "integer",
"uid": "string",
"display_name": "string",
"username": "string",
"email": "string",
"given_name": "string",
"middle_name": "string",
"name": "string",
"family_name": "string",
"nickname": "string",
"phone_number": "string",
"comment": "string",
"directory_id": "integer",
"picture_id": "integer",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
404 Not Found
400 Bad Request
Code sample
$ curl -X POST {WEAVY_SERVER}/api/users/1/trash
-H "Authorization: Bearer {API-KEY}"
Restore user
Restore a user from the trash.
POST /api/users/{id}/restore
Path parameters
id
integer requiredId of the user to restore.
Response codes
200 Success
{
"id": "integer",
"uid": "string",
"display_name": "string",
"username": "string",
"email": "string",
"given_name": "string",
"middle_name": "string",
"name": "string",
"family_name": "string",
"nickname": "string",
"phone_number": "string",
"comment": "string",
"directory_id": "integer",
"picture_id": "integer",
"avatar_url": "string",
"metadata": "object",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Code sample
$ curl -X POST {WEAVY_SERVER}/api/users/1/restore
-H "Authorization: Bearer {API-KEY}"
List user (autocomplete)
List users based on autocomplete search.
GET /api/users/autocomplete
Query parameters
q
stringThe search phrase to use.
top
integerMax number of items to returnm defaults to
5
.
id
integerOptional app id. When set, the result contains a property indicating wheter the listed users are member of the specified app or not.
Response codes
200 Success
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}
Code sample
curl https://{WEAVY-SERVER}/api/users/autocomplete?q=john
-H "Authorization: Bearer {ACCESS-TOKEN | API-KEY}"
Get access token
Issues an access token for a user. If a user with the with the specified uid
does not exists, this endpoint first creates the user and then issues an access_token
.
POST /api/users/{uid}/tokens
Path parameters
uid
string requiredUnique user identifier.
Body parameters
expires_in
integerThe lifetime of the access token in seconds, defaults to 3600 seconds (1 hour) when not specified.
Response codes
200 Success
{
"access_token": "string",
"expires_in": "integer"
}
Code sample
curl https://{WEAVY-SERVER}/api/users/user-1/tokens
-H "Authorization: Bearer {API-KEY}"
-H "Content-Type: application/json"
-d "{ 'expires_in': 7200 }"
Revoke access token
Revoke all access tokens for the specified user.
DELETE /api/users/{uid}/tokens
Path parameters
uid
string requiredUnique user identifier.
Response codes
200 Success
Code sample
$ curl -X DELETE {WEAVY_SERVER}/api/users/user-1/tokens
-H "Authorization: Bearer {API-KEY}"