Webservices » History » Version 5
Sachin Divekar, 21/11/2023 04:15 PM
| 1 | 2 | Sachin Divekar | >{{toc}} |
|---|---|---|---|
| 2 | 1 | Sachin Divekar | |
| 3 | # user_create |
||
| 4 | |||
| 5 | Creates a new user. |
||
| 6 | |||
| 7 | ## Request |
||
| 8 | |||
| 9 | **Endpoint** |
||
| 10 | |||
| 11 | ``` |
||
| 12 | POST /users |
||
| 13 | ``` |
||
| 14 | |||
| 15 | 2 | Sachin Divekar | **Body:** |
| 16 | 1 | Sachin Divekar | |
| 17 | ```json |
||
| 18 | { |
||
| 19 | 2 | Sachin Divekar | "realm": "vendors", |
| 20 | 1 | Sachin Divekar | "username": "rahuld", |
| 21 | "email": "rahul@example.com", |
||
| 22 | "firstName": "Rahul", |
||
| 23 | "lastName": "Deshpande", |
||
| 24 | "enabled": true |
||
| 25 | } |
||
| 26 | ``` |
||
| 27 | 2 | Sachin Divekar | - `realm` (string): Name of the realm for new user creation. |
| 28 | 1 | Sachin Divekar | - `username`: string, required. Username for the user. |
| 29 | - `email`: string, required. User's email address. |
||
| 30 | - `firstName`: string, optional. User's first name. |
||
| 31 | - `lastName`: string, optional. User's last name. |
||
| 32 | - `enabled`: boolean, required. Indicates if user account is enabled. |
||
| 33 | |||
| 34 | ## Response |
||
| 35 | |||
| 36 | ```json |
||
| 37 | { |
||
| 38 | "id": "df84nsd....", |
||
| 39 | "username": "rahuld", |
||
| 40 | "email": "rahul@example.com", |
||
| 41 | "firstName": "Rahul", |
||
| 42 | "lastName": "Deshpande", |
||
| 43 | "enabled": true |
||
| 44 | } |
||
| 45 | ``` |
||
| 46 | |||
| 47 | - `id`: string, required. Unique user ID. |
||
| 48 | - `username`: string, required. Username for the user. |
||
| 49 | - `email`: string, optional. User's email address. |
||
| 50 | - `firstName`: string, optional. User's first name. |
||
| 51 | - `lastName`: string, optional. User's last name. |
||
| 52 | - `enabled`: boolean, required. Indicates if user account is enabled. |
||
| 53 | |||
| 54 | 2 | Sachin Divekar | ## Errors |
| 55 | 1 | Sachin Divekar | - `REALM_NOT_FOUND`: Specified realm does not exist. |
| 56 | - `USERNAME_EXISTS`: User with provided username already exists in the realm. |
||
| 57 | 2 | Sachin Divekar | |
| 58 | # `user_get` |
||
| 59 | |||
| 60 | The `user_get` call retrieves the details of a specific user in a specific realm. It returns the complete user definition in JSON format. |
||
| 61 | |||
| 62 | ## Request |
||
| 63 | |||
| 64 | **Endpoint:** |
||
| 65 | |||
| 66 | 3 | Sachin Divekar | `GET /user` |
| 67 | 2 | Sachin Divekar | |
| 68 | **URL Parameters:** |
||
| 69 | 1 | Sachin Divekar | |
| 70 | 3 | Sachin Divekar | - `id` (string): The unique ID of the user. |
| 71 | - `name` (string): User name |
||
| 72 | 4 | Sachin Divekar | - `realm` (string): Realm to use for retrieving the user. This is a mandatory parameter. |
| 73 | 1 | Sachin Divekar | |
| 74 | 4 | Sachin Divekar | `realm` is mandatory. One of id or name must be present. |
| 75 | 2 | Sachin Divekar | |
| 76 | No request body required. |
||
| 77 | |||
| 78 | ## Response |
||
| 79 | |||
| 80 | **Body**: |
||
| 81 | |||
| 82 | ```json |
||
| 83 | { |
||
| 84 | "id": "df84nsd...", |
||
| 85 | "username": "rahuld", |
||
| 86 | "email": "rahul@example.com", |
||
| 87 | "firstName": "Rahul", |
||
| 88 | "lastName": "Deshpande", |
||
| 89 | "emailVerified": true, |
||
| 90 | "enabled": true, |
||
| 91 | "attributes": { |
||
| 92 | "vendor": true |
||
| 93 | } |
||
| 94 | } |
||
| 95 | |||
| 96 | ``` |
||
| 97 | - `id`: string, required. The unique ID of the user. |
||
| 98 | - `username`: string, required. The username for the user. |
||
| 99 | - `email`: string, optional. The user's email address. |
||
| 100 | - `firstName`: string, optional. The user's first name. |
||
| 101 | - `lastName`: string, optional. The user's last name. |
||
| 102 | - `emailVerified`: boolean, optional. A flag indicating whether the user's email address has been verified. |
||
| 103 | - `enabled`: boolean, required. A flag indicating whether the user account is enabled. |
||
| 104 | - `attributes`: object, optional. A map of additional attributes for the user. |
||
| 105 | |||
| 106 | ## Errors |
||
| 107 | 5 | Sachin Divekar | - `USER_NOT_FOUND`: The specified user does not exist in the realm. |
| 108 | - `USERNAME_EXISTS`: User with provided username already exists in the realm. |