This function takes pagination parameters `page` and `per_page` to restrict the list of users.
This function takes pagination parameters `page` and `per_page` to restrict the list of users.
### For normal users:
### For normal users
```
```
GET /users
GET /users
...
@@ -31,8 +31,7 @@ GET /users
...
@@ -31,8 +31,7 @@ GET /users
]
]
```
```
### For admins
### For admins:
```
```
GET /users
GET /users
...
@@ -92,7 +91,7 @@ Also see `def search query` in `app/models/user.rb`.
...
@@ -92,7 +91,7 @@ Also see `def search query` in `app/models/user.rb`.
Get a single user.
Get a single user.
#### For user:
### For user
```
```
GET /users/:id
GET /users/:id
...
@@ -112,8 +111,7 @@ Parameters:
...
@@ -112,8 +111,7 @@ Parameters:
}
}
```
```
### For admin
#### For admin:
```
```
GET /users/:id
GET /users/:id
...
@@ -161,13 +159,13 @@ Parameters:
...
@@ -161,13 +159,13 @@ Parameters:
-`username` (required) - Username
-`username` (required) - Username
-`name` (required) - Name
-`name` (required) - Name
-`skype` (optional) - Skype ID
-`skype` (optional) - Skype ID
-`linkedin` (optional) - Linkedin
-`linkedin` (optional) - LinkedIn
-`twitter` (optional) - Twitter account
-`twitter` (optional) - Twitter account
-`website_url` (optional) - Website url
-`website_url` (optional) - Website URL
-`projects_limit` (optional) - Number of projects user can create
-`projects_limit` (optional) - Number of projects user can create
-`extern_uid` (optional) - External UID
-`extern_uid` (optional) - External UID
-`provider` (optional) - External provider name
-`provider` (optional) - External provider name
-`bio` (optional) - User's bio
-`bio` (optional) - User's biography
-`admin` (optional) - User is admin - true or false (default)
-`admin` (optional) - User is admin - true or false (default)
-`can_create_group` (optional) - User can create groups - true or false
-`can_create_group` (optional) - User can create groups - true or false
...
@@ -186,21 +184,27 @@ Parameters:
...
@@ -186,21 +184,27 @@ Parameters:
-`name` - Name
-`name` - Name
-`password` - Password
-`password` - Password
-`skype` - Skype ID
-`skype` - Skype ID
-`linkedin` - Linkedin
-`linkedin`- LinkedIn
-`twitter` - Twitter account
-`twitter` - Twitter account
-`website_url` - Website url
-`website_url`- Website URL
-`projects_limit` - Limit projects each user can create
-`projects_limit` - Limit projects each user can create
-`extern_uid` - External UID
-`extern_uid` - External UID
-`provider` - External provider name
-`provider` - External provider name
-`bio` - User's bio
-`bio`- User's biography
-`admin` (optional) - User is admin - true or false (default)
-`admin` (optional) - User is admin - true or false (default)
-`can_create_group` (optional) - User can create groups - true or false
-`can_create_group` (optional) - User can create groups - true or false
Note, at the moment this method does only return a 404 error, even in cases where a 409 (Conflict) would be more appropriate, e.g. when renaming the email address to some existing one.
Note, at the moment this method does only return a 404 error,
even in cases where a 409 (Conflict) would be more appropriate,
e.g. when renaming the email address to some existing one.
## User deletion
## User deletion
Deletes a user. Available only for administrators. This is an idempotent function, calling this function for a non-existent user id still returns a status code `200 Ok`. The JSON response differs if the user was actually deleted or not. In the former the user is returned and in the latter not.
Deletes a user. Available only for administrators.
This is an idempotent function, calling this function for a non-existent user id
still returns a status code `200 Ok`.
The JSON response differs if the user was actually deleted or not.
In the former the user is returned and in the latter not.
```
```
DELETE /users/:id
DELETE /users/:id
...
@@ -330,7 +334,9 @@ Will return created key with status `201 Created` on success, or `404 Not found`
...
@@ -330,7 +334,9 @@ Will return created key with status `201 Created` on success, or `404 Not found`
## Delete SSH key for current user
## Delete SSH key for current user
Deletes key owned by currently authenticated user. This is an idempotent function and calling it on a key that is already deleted or not available results in `200 Ok`.
Deletes key owned by currently authenticated user.
This is an idempotent function and calling it on a key that is already deleted