# User

### Me

<mark style="color:blue;">`GET`</mark> `[ENADOC_URL] /api/v3/me`

Use this method to obtain logged user/current user details

#### Headers

| Name          | Type   | Description                                                           |
| ------------- | ------ | --------------------------------------------------------------------- |
| Authorization | string | <p>Type - Bearer<br>Access token should be sent in request header</p> |

{% tabs %}
{% tab title="200 If the request is success, you will receive status code 200 with the details of current user. The details consist of user Id, organization Id, organization name, organization logo url, security level, user name, email, first name, last name, is restricted status, is active status, is first login status, user image/profile url, full name." %}

```json
{
  "id": 1,
  "organizationId": 1,
  "organizationName": "Enadoc",
  "organizationLogoUrl": "https://portal.enadoc.com/api/v3/organizations/1/logo",
  "securityLevel": 6,
  "userName": "johnss@enadoc.com",
  "email": "johnss@enadoc.com",
  "firstName": "John",
  "lastName": "Smith",
  "isRestricted": false,
  "isActive": true,
  "isFirstLogin": false,
  "imageUrl": "https://portal.enadoc.com/api/v3/contents/picture?token=ZGVmYXVsdC5wbmc%3d-8%2f6OH3Pk6dgfdv0%3d",
  "fullName": "John Smith"
}
```

{% endtab %}
{% endtabs %}

### Get Users

<mark style="color:blue;">`GET`</mark> `[ENADOC_URL] /api/v3/users`

***Pre-requisites from Enadoc:*** Y*ou must have already added users under your Enadoc organization*

#### Query Parameters

| Name | Type    | Description            |
| ---- | ------- | ---------------------- |
| from | integer | Starting point         |
| to   | integer | End point              |
| q    | string  | Search text; user name |
| type | String  | type should be sign    |

#### Headers

| Name                                            | Type   | Description                                                          |
| ----------------------------------------------- | ------ | -------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | <p>Type-Bearer<br>Access token should be sent in request headers</p> |

{% tabs %}
{% tab title="200 If request proceeds successfully, you will receive status code 200 with user count and list of users with details. The details of each user consist of user Id, organization Id, organization name, organization logo url, security level, user name, email, first name, last name, is restricted status, is active status, is first login status, user image/profile url, full name. If type is sign, then details would be id, username, email, first name, last name, full name only. " %}

```json
{
  "count": 1,
  "users": [
    {
      "id": 1,
      "organizationId": 1,
      "organizationName": "Enadoc",
      "organizationLogoUrl": "https://portal.enadoc.com/api/v3/organizations/1/logo",
      "securityLevel": 6,
      "userName": "meghon@enadoc.com",
      "email": "meghon@enadoc.com",
      "firstName": "Meghon",
      "lastName": "Charlotte",
      "isRestricted": false,
      "isActive": true,
      "isFirstLogin": false,
      "imageUrl": "https://portal.enadoc.com/api/v3/contents/picture?token=ZGVmYXV1sdC5wbmsdfsdfc%3d-8%2f6OH3Pk6v0%3d",
      "fullName": "Meghon Charlotte "
    }
  ]
}json
```

{% endtab %}
{% endtabs %}

### Get Specific User (From User id)

<mark style="color:blue;">`GET`</mark> `[ENADOC_URL] /api/v3/users/{userid}`

#### Path Parameters

| Name   | Type    | Description |
| ------ | ------- | ----------- |
| userid | integer | User Id     |

#### Headers

| Name          | Type   | Description                                                          |
| ------------- | ------ | -------------------------------------------------------------------- |
| Authorization | string | <p>Type - Bearer<br>Access token will be sent in request headers</p> |

{% tabs %}
{% tab title="200 If request process successfully, you will get the status code 200 with the details of requested user. The details consist of user Id, organization Id, organization name, organization logo url, security level, user name, email, first name, last name, is restricted status, is active status, is first login status, user image/profile url, full name.
" %}

```json
{
  "id": 1,
  "organizationId": 1,
  "organizationName": "Enadoc",
  "organizationLogoUrl": "https://portal.enadoc.com/api/v3/organizations/1/logo",
  "securityLevel": 6,
  "userName": "olivias@enadoc.com",
  "email": "olivias@enadoc.com",
  "firstName": "Saga",
  "lastName": "Olivia",
  "isRestricted": false,
  "isActive": true,
  "isFirstLogin": false,
  "imageUrl": "https://portal.enadoc.com/api/v3/contents/picture?token=ZGBNVmYXssVsdC5wbmc%3d-8%2f6OH3Pk6v0%3d",
  "fullName": "Saga Olivia"
}
```

{% endtab %}
{% endtabs %}

### Get Specific User  (From Username)

<mark style="color:blue;">`GET`</mark> `[ENADOC_URL]/api/v3/users/{username}`

#### Path Parameters

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| username<mark style="color:red;">\*</mark> | String | Username    |

#### Headers

| Name                                            | Type   | Description                                                           |
| ----------------------------------------------- | ------ | --------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | <p>Type-Bearer</p><p>Access token will be sent in request headers</p> |

{% tabs %}
{% tab title="200: OK If the request processing successfully, you will get the status code 200 with the status of requested users" %}

```json
{
"id": 1,
"organizationId": 321,
"organizationName": "Enadoc",
"organizationLogoUrl": "https://qa.enadocapp.com/api/v3/organizations/321/logo",
"securityLevel": 6,
"userType": 1,
"userName": "olivias@enadoc.com",
"email": "olivias@enadoc.com",
"firstName": "Saga",
"lastName": "Olivia",
"isRestricted": false,
"isActive": true,
"isFirstLogin": false,
"imageUrl": "https://qa.enadocapp.com/api/v3/contents/picture?token=ZGVmYXVsdC5wbmc%3d-8%2f6OH3Pk6v0%3d",
"fullName": "Saga Olivia"
}
```

{% endtab %}
{% endtabs %}

### Get Specific User's Settings

<mark style="color:blue;">`GET`</mark> `[ENADOC_URL] /api/v3/users/{userid}/settings`

***Pre-requisites from Enadoc:*** *You must have already added users under your Enadoc organization.*

#### Path Parameters

| Name   | Type    | Description |
| ------ | ------- | ----------- |
| userid | integer | User Id     |

#### Headers

| Name          | Type   | Description                                                           |
| ------------- | ------ | --------------------------------------------------------------------- |
| Authorization | string | <p>Type - Bearer <br>Access token will be sent in request headers</p> |

{% tabs %}
{% tab title="200 If request proceeds successfully, you will receive status code 200 with the details of user settings. Requested user settings will be received in response.
" %}

```json
{
  "dateFormat": "dd.MM.yyyy"
}
```

{% endtab %}
{% endtabs %}

### Get Specific User's User Group

<mark style="color:blue;">`GET`</mark> `[ENADOC_URL] /api/v3/users/{userid}/usergroups`

***Pre-requisites from Enadoc:*** *You must have already added users under your Enadoc organization.*

#### Path Parameters

| Name   | Type    | Description |
| ------ | ------- | ----------- |
| userid | integer | User Id     |

#### Headers

| Name          | Type   | Description                                                           |
| ------------- | ------ | --------------------------------------------------------------------- |
| Authorization | string | <p>Type - Bearer <br>Access token will be sent in request headers</p> |

{% tabs %}
{% tab title="200 If the request proceeds success, you will receive status code 200 with the details of user groups list which the given user belongs to. The details consist of user group id, user group name, user group description, user group security level. Requested user groups will be received in respond.

" %}

```json
[
  {
    "id": 1,
    "name": "Administrators",
    "description": "",
    "securityLevel": 6
  }
]
```

{% endtab %}
{% endtabs %}

### Create Users

<mark style="color:green;">`POST`</mark> `[ENADOC_URL] /api/v3/users`

Use this API method to create new users.

#### Headers

| Name          | Type   | Description                                 |
| ------------- | ------ | ------------------------------------------- |
| Authorization | string | Access token will be sent in request header |

#### Request Body

| Name          | Type    | Description            |
| ------------- | ------- | ---------------------- |
| userName      | string  | User name of user      |
| password      | string  | Password of user       |
| userGroupID   | integer | User group of user     |
| securityLevel | integer | Security level of user |
| isO365User    | boolean | Is office 365 user     |
| userType      | integer | User type of user      |

{% tabs %}
{% tab title="201 If the request proceeds success, you will receive status code 201 with the details of newly created user. The details consist of user id, organization id, organization name, organization logo url, security level, user type, user name, email, first name, last name, Is restricted status, is active status, is first login status, image url, full name.
" %}

```json
{
  "id": 1,
  "organizationId": 1,
  "organizationName": "Enadoc",
  "organizationLogoUrl": "https://qa.enadoc.com/api/v3/organizations/1/logo",
  "securityLevel": 4,
  "userType": null,
  "userName": "john@enadoc.com",
  "email": "john@enadoc.com",
  "firstName": "John",
  "lastName": "Frediq",
  "isRestricted": false,
  "isActive": true,
  "isFirstLogin": false,
  "imageUrl": "",
  "fullName": "John Frediq"
}
```

{% endtab %}
{% endtabs %}

##
