# openapi.api.UsersApi ## Load the API package ```dart import 'package:openapi/api.dart'; ``` All URIs are relative to *https://community.openproject.org* Method | HTTP request | Description ------------- | ------------- | ------------- [**createUser**](UsersApi.md#createuser) | **POST** /api/v3/users | Create User [**deleteUser**](UsersApi.md#deleteuser) | **DELETE** /api/v3/users/{id} | Delete user [**listUsers**](UsersApi.md#listusers) | **GET** /api/v3/users | List Users [**lockUser**](UsersApi.md#lockuser) | **POST** /api/v3/users/{id}/lock | Lock user [**unlockUser**](UsersApi.md#unlockuser) | **DELETE** /api/v3/users/{id}/lock | Unlock user [**updateUser**](UsersApi.md#updateuser) | **PATCH** /api/v3/users/{id} | Update user [**userUpdateForm**](UsersApi.md#userupdateform) | **POST** /api/v3/users/{id}/form | User update form [**viewUser**](UsersApi.md#viewuser) | **GET** /api/v3/users/{id} | View user [**viewUserSchema**](UsersApi.md#viewuserschema) | **GET** /api/v3/users/schema | View user schema # **createUser** > UserModel createUser(userCreateModel) Create User Creates a new user. Only administrators and users with manage_user global permission are allowed to do so. When calling this endpoint the client provides a single object, containing at least the properties and links that are required, in the body. Valid values for `status`: 1) \"active\" - In this case a password has to be provided in addition to the other attributes. 2) \"invited\" - In this case nothing but the email address is required. The rest is optional. An invitation will be sent to the user. ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = UsersApi(); final userCreateModel = UserCreateModel(); // UserCreateModel | try { final result = api_instance.createUser(userCreateModel); print(result); } catch (e) { print('Exception when calling UsersApi->createUser: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **userCreateModel** | [**UserCreateModel**](UserCreateModel.md)| | [optional] ### Return type [**UserModel**](UserModel.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/hal+json, text/plain [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **deleteUser** > deleteUser(id) Delete user Permanently deletes the specified user account. ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = UsersApi(); final id = 1; // int | User id try { api_instance.deleteUser(id); } catch (e) { print('Exception when calling UsersApi->deleteUser: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| User id | ### Return type void (empty response body) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **listUsers** > UserCollectionModel listUsers(offset, pageSize, filters, sortBy, select) List Users Lists users. Only administrators or users with manage_user global permission have permission to do this. ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = UsersApi(); final offset = 25; // int | Page number inside the requested collection. final pageSize = 25; // int | Number of elements to display per page. final filters = [{ "status": { "operator": "=", "values": ["invited"] } }, { "group": { "operator": "=", "values": ["1"] } }, { "name": { "operator": "=", "values": ["h.wurst@openproject.com"] } }]; // String | JSON specifying filter conditions. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported filters are: + status: Status the user has + group: Name of the group in which to-be-listed users are members. + name: Filter users in whose first or last names, or email addresses the given string occurs. + login: User's login final sortBy = [["status", "asc"]]; // String | JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. final select = total,elements/name,elements/self,self; // String | Comma separated list of properties to include. try { final result = api_instance.listUsers(offset, pageSize, filters, sortBy, select); print(result); } catch (e) { print('Exception when calling UsersApi->listUsers: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **offset** | **int**| Page number inside the requested collection. | [optional] [default to 1] **pageSize** | **int**| Number of elements to display per page. | [optional] **filters** | **String**| JSON specifying filter conditions. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. Currently supported filters are: + status: Status the user has + group: Name of the group in which to-be-listed users are members. + name: Filter users in whose first or last names, or email addresses the given string occurs. + login: User's login | [optional] **sortBy** | **String**| JSON specifying sort criteria. Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/) endpoint. | [optional] **select** | **String**| Comma separated list of properties to include. | [optional] ### Return type [**UserCollectionModel**](UserCollectionModel.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **lockUser** > UserModel lockUser(id) Lock user ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = UsersApi(); final id = 1; // int | User id try { final result = api_instance.lockUser(id); print(result); } catch (e) { print('Exception when calling UsersApi->lockUser: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| User id | ### Return type [**UserModel**](UserModel.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json, text/plain [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **unlockUser** > UserModel unlockUser(id) Unlock user ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = UsersApi(); final id = 1; // int | User id try { final result = api_instance.unlockUser(id); print(result); } catch (e) { print('Exception when calling UsersApi->unlockUser: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| User id | ### Return type [**UserModel**](UserModel.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json, text/plain [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **updateUser** > UserModel updateUser(id, userCreateModel) Update user Updates the user's writable attributes. When calling this endpoint the client provides a single object, containing at least the properties and links that are required, in the body. ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = UsersApi(); final id = 1; // int | User id final userCreateModel = UserCreateModel(); // UserCreateModel | try { final result = api_instance.updateUser(id, userCreateModel); print(result); } catch (e) { print('Exception when calling UsersApi->updateUser: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| User id | **userCreateModel** | [**UserCreateModel**](UserCreateModel.md)| | [optional] ### Return type [**UserModel**](UserModel.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/hal+json, text/plain [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **userUpdateForm** > userUpdateForm(id) User update form ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = UsersApi(); final id = 1; // int | User id try { api_instance.userUpdateForm(id); } catch (e) { print('Exception when calling UsersApi->userUpdateForm: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **int**| User id | ### Return type void (empty response body) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json, text/plain [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **viewUser** > UserModel viewUser(id) View user ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = UsersApi(); final id = 1; // String | User id. Use `me` to reference current user, if any. try { final result = api_instance.viewUser(id); print(result); } catch (e) { print('Exception when calling UsersApi->viewUser: $e\n'); } ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **String**| User id. Use `me` to reference current user, if any. | ### Return type [**UserModel**](UserModel.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **viewUserSchema** > Object viewUserSchema() View user schema The schema response use two exemplary custom fields that extend the schema response. Depending on your instance and custom field configuration, the response will look somewhat different. ### Example ```dart import 'package:openapi/api.dart'; // TODO Configure HTTP basic authorization: BasicAuth //defaultApiClient.getAuthentication('BasicAuth').username = 'YOUR_USERNAME' //defaultApiClient.getAuthentication('BasicAuth').password = 'YOUR_PASSWORD'; final api_instance = UsersApi(); try { final result = api_instance.viewUserSchema(); print(result); } catch (e) { print('Exception when calling UsersApi->viewUserSchema: $e\n'); } ``` ### Parameters This endpoint does not need any parameter. ### Return type [**Object**](Object.md) ### Authorization [BasicAuth](../README.md#BasicAuth) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/hal+json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)