Users
The Users API has methods for managing users.
Create user
POST /api/users
Create a user.
Sample request
$ curl {WEAVY_SERVER}/api/users
-H "Authorization: Bearer {WEAVY_APIKEY}"
-H "Content-Type: application/json"
-d "{ 'uid': 'user-1', 'name': 'John Doe', 'directory': 'acme' }"
Request body
application/json
{
"uid": "string",
"username?": "string",
"email?": "string",
"given_name?": "string",
"middle_name?": "string",
"name?": "string",
"family_name?": "string",
"nickname?": "string",
"phone_number?": "string",
"comment?": "string",
"picture?": "string",
"directory?": "string",
"metadata?": {},
"tags?": [
"string"
],
"is_suspended?": "boolean"
}
Note. Properties marked with ? are optional.
Responses
Status code 201
application/json
{
"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",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Status code 400
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
List users
GET /api/users
List users.
Sample request
$ curl {WEAVY_SERVER}/api/users?top=20
-H "Authorization: Bearer {WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
directory_id | integer | False | |
suspended | boolean | False | |
q | string | False | |
tag | string | False | |
trashed | boolean | False | |
order_by | string | False | |
top | integer | False | |
skip | integer | False | |
count | boolean | False | |
count_only | boolean | False |
Responses
Status code 200
application/json
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}
Get user
GET /api/users/{id}
Get a user by id.
Sample request
$ curl {WEAVY_SERVER}/api/users/1
-H "Authorization: Bearer {WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Id of user. |
trashed | boolean | False |
Responses
Status code 200
application/json
{
"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",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Update user
PATCH /api/users/{id}
Update a user.
Sample request
$ curl -X PATCH {WEAVY_SERVER}/api/users/1
-H "Authorization: Bearer {WEAVY_APIKEY}"
-H "Content-Type: application/json"
-d "{ 'name': 'Updated name' }"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True |
Request body
application/json
{
"uid?": "string",
"username?": "string",
"email?": "string",
"given_name?": "string",
"middle_name?": "string",
"name?": "string",
"family_name?": "string",
"nickname?": "string",
"phone_number?": "string",
"comment?": "string",
"picture?": "string",
"directory?": "string",
"metadata?": {},
"tags?": [
"string"
],
"is_suspended?": "boolean"
}
Note. Properties marked with ? are optional.
Responses
Status code 204
No Content
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Status code 400
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Get user (uid)
GET /api/users/{uid}
Get a user by uid.
Sample request
$ curl {WEAVY_SERVER}/api/users/user-1
-H "Authorization: Bearer {WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
uid | string | True | Unique user identifier. |
trashed | boolean | False |
Responses
Status code 200
application/json
{
"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",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Sync user
PUT /api/users/{uid}
Create or update user with specified uid.
Sample request
$ curl -X PUT {WEAVY_SERVER}/api/users/user-1
-H "Authorization: Bearer {WEAVY_APIKEY}"
-H "Content-Type: application/json"
-d "{ 'name': 'John Doe', 'email': 'john@acme.com' }"
Parameters
Name | Type | Required | Description |
---|---|---|---|
uid | string | True | Unique user identifier. |
Request body
application/json
{
"username?": "string",
"email?": "string",
"given_name?": "string",
"middle_name?": "string",
"name?": "string",
"family_name?": "string",
"nickname?": "string",
"phone_number?": "string",
"comment?": "string",
"picture?": "string",
"directory?": "string",
"metadata?": {},
"tags?": [
"string"
],
"is_suspended?": "boolean"
}
Note. Properties marked with ? are optional.
Responses
Status code 200
application/json
{
"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",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Get authenticated user
GET /api/user
Get the authenticated user.
Sample request
$ curl {WEAVY_SERVER}/api/user
-H "Authorization: Bearer {ACCESS_TOKEN}"
Responses
Status code 200
application/json
{
"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",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Trash user
POST /api/users/{id}/trash
Move a user to the trash.
Sample request
$ curl -X POST {WEAVY_SERVER}/api/users/1/trash
-H "Authorization: Bearer {WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Id of the user to trash. |
Responses
Status code 200
application/json
{
"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",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
Status code 404
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Status code 400
application/json
{
"type": "string",
"title": "string",
"status": "integer",
"detail": "string",
"instance": "string"
}
Restore user
POST /api/users/{id}/restore
Restore a user from the trash.
Sample request
$ curl -X POST {WEAVY_SERVER}/api/users/1/restore
-H "Authorization: Bearer {WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
id | integer | True | Id of the user to restore. |
Responses
Status code 200
application/json
{
"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",
"tags": [
"string"
],
"presence": "string",
"created_at": "string",
"modified_at": "string",
"is_admin": "boolean",
"is_suspended": "boolean",
"is_trashed": "boolean"
}
List user (autocomplete)
GET /api/users/autocomplete
List users based on autocomplete search.
Sample request
$ curl {WEAVY_SERVER}/api/users/autocomplete?q=john
-H "Authorization: Bearer {ACCESS_TOKEN | WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
q | string | False | The search phrase to use. |
top | integer | False | Max number of items to return. |
id | integer | False | Optional app id. When set, the result contains a property indicating wheter the user is a member of the specified app or not. |
Responses
Status code 200
application/json
{
"data": [
"object"
],
"start": "integer",
"end": "integer",
"count": "integer"
}
Get access token
POST /api/users/{uid}/tokens
Issue an access token for the specified user. Creates the user if it does not exists.
Sample request
$ curl {WEAVY_SERVER}/api/users/user-1/tokens
-H "Authorization: Bearer {WEAVY_APIKEY}"
-H "Content-Type: application/json"
-d "{ 'expires_in': 7200 }"
Parameters
Name | Type | Required | Description |
---|---|---|---|
uid | string | True | Unique user identifier. |
Request body
application/json
{
"expires_in?": "integer"
}
Note. Properties marked with ? are optional.
Responses
Status code 200
application/json
{
"access_token": "string",
"expires_in": "integer"
}
Revoke access token
DELETE /api/users/{uid}/tokens
Revoke all access tokens for the specified user.
Sample request
$ curl -X DELETE {WEAVY_SERVER}/api/users/user-1/tokens
-H "Authorization: Bearer {WEAVY_APIKEY}"
Parameters
Name | Type | Required | Description |
---|---|---|---|
uid | string | True |
Responses
Status code 200
Success