# User

> **Package : spaceone.api.identity.v1**

## User

{% hint style="info" %}
**User Methods:**
{% endhint %}

| NO | Method                           | Request Type                                    | Response Type                                                                                                      | Description                        |
| -- | -------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ---------------------------------- |
| 1  | [**create**](#create)            | [CreateUserRequest](#createuserrequest)         | [UserInfo](#userinfo)                                                                                              |                                    |
| 2  | [**update**](#update)            | [UpdateUserRequest](#updateuserrequest)         | [UserInfo](#userinfo)                                                                                              | Update user info by given user\_id |
| 3  | [**enable**](#enable)            | [UserRequest](#userrequest)                     | [UserInfo](#userinfo)                                                                                              |                                    |
| 4  | [**disable**](#disable)          | [UserRequest](#userrequest)                     | [UserInfo](#userinfo)                                                                                              |                                    |
| 5  | [**update\_role**](#update_role) | [UpdateUserRoleRequest](#updateuserrolerequest) | [UserInfo](#userinfo)                                                                                              |                                    |
| 6  | [**delete**](#delete)            | [UserRequest](#userrequest)                     | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |                                    |
| 7  | [**get**](#get)                  | [GetUserRequest](#getuserrequest)               | [UserInfo](#userinfo)                                                                                              |                                    |
| 8  | [**list**](#list)                | [UserQuery](#userquery)                         | [UsersInfo](#usersinfo)                                                                                            |                                    |
| 9  | [**stat**](#stat)                | [UserStatQuery](#userstatquery)                 | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |                                    |
| 10 | [**find**](#find)                | [FindUserQuery](#finduserquery)                 | [FindUsersInfo](#findusersinfo)                                                                                    |                                    |
| 11 | [**sync**](#sync)                | [UserRequest](#userrequest)                     | [UserInfo](#userinfo)                                                                                              |                                    |

### create

> **POST** /identity/v1/users

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [CreateUserRequest](#createuserrequest) |
| Response | [UserInfo](#userinfo)                   |

### update

> **PUT** /identity/v1/users
>
> Update user info by given user\_id

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [UpdateUserRequest](#updateuserrequest) |
| Response | [UserInfo](#userinfo)                   |

{% tabs %}
{% tab title="Request Example" %}

```
{
    "user_id": "dkang@mz.co.kr",
    "tags": [
        {
            "key": "user1",
            "value": "Reuters"
        },
        {
            "key": "user2",
            "value": "Bloomberg"
        }
    ],
    "domain_id": "{{DOMAIN_ID}}"
}
```

{% endtab %}

{% tab title="Response Example" %}

```
{
    "roles": [],
    "user_id": "dkang@mz.co.kr",
    "name": "Dong Yoo kang",
    "state": "ENABLED",
    "email": "dkang@mz.co.kr",
    "language": "en",
    "timezone": "UTC",
    "tags": [
        {
            "key": "user1",
            "value": "Reuters"
        },
        {
            "key": "user2",
            "value": "Bloomberg"
        }
    ],
    "last_accessed_at": {
        "seconds": "1593161630",
        "nanos": 79000000
    },
    "created_at": {
        "seconds": "1593161630",
        "nanos": 79000000
    },
    "domain_id": "domain-fd6e23a5ae36"
}
```

{% endtab %}
{% endtabs %}

### enable

> **PUT** /identity/v1/user/{user\_id}/enable

| Type     | Message                     |
| -------- | --------------------------- |
| Request  | [UserRequest](#userrequest) |
| Response | [UserInfo](#userinfo)       |

### disable

> **PUT** /identity/v1/user/{user\_id}/disable

| Type     | Message                     |
| -------- | --------------------------- |
| Request  | [UserRequest](#userrequest) |
| Response | [UserInfo](#userinfo)       |

### update\_role

> **PUT** /identity/v1/user/{user\_id}/roles

| Type     | Message                                         |
| -------- | ----------------------------------------------- |
| Request  | [UpdateUserRoleRequest](#updateuserrolerequest) |
| Response | [UserInfo](#userinfo)                           |

### delete

> **DELETE** /identity/v1/users

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [UserRequest](#userrequest)                                                                                      |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

### get

> **GET** /identity/v1/user/{user\_id}

| Type     | Message                           |
| -------- | --------------------------------- |
| Request  | [GetUserRequest](#getuserrequest) |
| Response | [UserInfo](#userinfo)             |

### list

> **GET** /identity/v1/users
>
> **POST** /identity/v1/users/search

| Type     | Message                 |
| -------- | ----------------------- |
| Request  | [UserQuery](#userquery) |
| Response | [UsersInfo](#usersinfo) |

### stat

> **POST** /identity/v1/users/stat

| Type     | Message                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Request  | [UserStatQuery](#userstatquery)                                                                                    |
| Response | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### find

> **POST** /identity/v1/users/find

| Type     | Message                         |
| -------- | ------------------------------- |
| Request  | [FindUserQuery](#finduserquery) |
| Response | [FindUsersInfo](#findusersinfo) |

### sync

> **POST** /identity/v1/users/sync

| Type     | Message                     |
| -------- | --------------------------- |
| Request  | [UserRequest](#userrequest) |
| Response | [UserInfo](#userinfo)       |

## Message

### CreateUserRequest

| No | Field      | Type                                                              | Required | Description |
| -- | ---------- | ----------------------------------------------------------------- | -------- | ----------- |
| 1  | user\_id   | string                                                            | ✅        |             |
| 2  | password   | string                                                            | ❌        |             |
| 3  | name       | string                                                            | ❌        |             |
| 4  | email      | string                                                            | ❌        |             |
| 5  | user\_type | <ul><li>NONE\_USER\_TYPE</li><li>USER</li><li>API\_USER</li></ul> | ❌        |             |
| 6  | backend    | <ul><li>NONE\_BACKEND</li><li>LOCAL</li><li>EXTERNAL</li></ul>    | ✅        |             |
| 7  | language   | string                                                            | ❌        |             |
| 8  | timezone   | string                                                            | ❌        |             |
| 9  | tags       | list of spaceone.api.core.v1.Tag                                  | ❌        |             |
| 10 | domain\_id | string                                                            | ✅        |             |

### FindUserInfo

| No | Field    | Type                             | Description |
| -- | -------- | -------------------------------- | ----------- |
| 1  | user\_id | string                           |             |
| 2  | name     | string                           |             |
| 3  | email    | string                           |             |
| 4  | tags     | list of spaceone.api.core.v1.Tag |             |

### FindUserQuery

| No | Field      | Type                              | Required | Description |
| -- | ---------- | --------------------------------- | -------- | ----------- |
| 1  | search     | [FindUserSearch](#findusersearch) | ✅        |             |
| 2  | domain\_id | string                            | ✅        |             |

### FindUserSearch

| No | Field    | Type   | Description |
| -- | -------- | ------ | ----------- |
| 1  | user\_id | string |             |
| 2  | keyword  | string |             |

### FindUsersInfo

| No | Field        | Type                                                                                            | Description |
| -- | ------------ | ----------------------------------------------------------------------------------------------- | ----------- |
| 1  | results      | [list of FindUserInfo](#finduserinfo)                                                           |             |
| 2  | total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |

### GetUserRequest

| No | Field      | Type           | Required | Description |
| -- | ---------- | -------------- | -------- | ----------- |
| 1  | user\_id   | string         | ✅        |             |
| 2  | domain\_id | string         | ✅        |             |
| 3  | only       | list of string | ❌        |             |

### UpdateUserRequest

| No | Field      | Type                             | Required | Description |
| -- | ---------- | -------------------------------- | -------- | ----------- |
| 1  | user\_id   | string                           | ✅        |             |
| 2  | password   | string                           | ❌        |             |
| 3  | name       | string                           | ❌        |             |
| 4  | email      | string                           | ❌        |             |
| 5  | language   | string                           | ❌        |             |
| 6  | timezone   | string                           | ❌        |             |
| 7  | tags       | list of spaceone.api.core.v1.Tag | ❌        |             |
| 8  | domain\_id | string                           | ✅        |             |

### UpdateUserRoleRequest

| No | Field      | Type                                                                                                | Required | Description |
| -- | ---------- | --------------------------------------------------------------------------------------------------- | -------- | ----------- |
| 1  | user\_id   | string                                                                                              | ✅        |             |
| 2  | roles      | [google.protobuf.ListValue](https://developers.google.com/protocol-buffers/docs/reference/overview) | ✅        |             |
| 3  | domain\_id | string                                                                                              | ✅        |             |

### UserInfo

| No | Field              | Type                                                                                                                     | Description |
| -- | ------------------ | ------------------------------------------------------------------------------------------------------------------------ | ----------- |
| 1  | user\_id           | string                                                                                                                   |             |
| 2  | name               | string                                                                                                                   |             |
| 3  | state              | <ul><li>NONE</li><li>ENABLED</li><li>DISABLED</li><li>PENDING</li></ul>                                                  |             |
| 4  | email              | string                                                                                                                   |             |
| 5  | user\_type         | <ul><li>NONE\_USER\_TYPE</li><li>USER</li><li>API\_USER</li></ul>                                                        |             |
| 6  | backend            | <ul><li>NONE\_BACKEND</li><li>LOCAL</li><li>EXTERNAL</li></ul>                                                           |             |
| 7  | language           | string                                                                                                                   |             |
| 8  | timezone           | string                                                                                                                   |             |
| 9  | roles              | [list of RoleInfo](#roleinfo)                                                                                            |             |
| 10 | tags               | list of spaceone.api.core.v1.Tag                                                                                         |             |
| 11 | last\_accessed\_at | [google.protobuf.Timestamp](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto) |             |
| 12 | created\_at        | [google.protobuf.Timestamp](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto) |             |
| 13 | domain\_id         | string                                                                                                                   |             |

### UserQuery

| No | Field      | Type                                                                                               | Required | Description |
| -- | ---------- | -------------------------------------------------------------------------------------------------- | -------- | ----------- |
| 1  | query      | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) | ❌        |             |
| 2  | user\_id   | string                                                                                             | ❌        |             |
| 3  | name       | string                                                                                             | ❌        |             |
| 4  | state      | string                                                                                             | ❌        |             |
| 5  | email      | string                                                                                             | ❌        |             |
| 6  | user\_type | <ul><li>NONE\_USER\_TYPE</li><li>USER</li><li>API\_USER</li></ul>                                  | ❌        |             |
| 7  | backend    | <ul><li>NONE\_BACKEND</li><li>LOCAL</li><li>EXTERNAL</li></ul>                                     | ❌        |             |
| 8  | role\_id   | string                                                                                             | ❌        |             |
| 9  | domain\_id | string                                                                                             | ❌        |             |

### UserRequest

| No | Field      | Type   | Required | Description |
| -- | ---------- | ------ | -------- | ----------- |
| 1  | user\_id   | string | ✅        |             |
| 2  | domain\_id | string | ✅        |             |

### UserStatQuery

| No | Field      | Type                                                                                                             | Required | Description |
| -- | ---------- | ---------------------------------------------------------------------------------------------------------------- | -------- | ----------- |
| 1  | query      | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query) | ✅        |             |
| 2  | domain\_id | string                                                                                                           | ✅        |             |

### UsersInfo

| No | Field        | Type                                                                                            | Description |
| -- | ------------ | ----------------------------------------------------------------------------------------------- | ----------- |
| 1  | results      | [list of UserInfo](#userinfo)                                                                   |             |
| 2  | total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |
