User
Create User
Description
Create a new user with the specified details.
Request Config
| Config | Definition |
|---|---|
| URL | /user |
| Method | POST |
| Content-Type | application/json |
Request Body Schema
| Name | Type | Description | Required |
|---|---|---|---|
| username | string | Login user name, maximum 50 bit | Yes |
| real_name | string | Real name, maximum 100 bit | No |
| password | string | Password, maximum 200 bit | Yes |
| nickname | string | Nickname, maximum 100 bit | No |
| gender | int32 | Gender, 1=male, 2=female | No |
| string | No | ||
| phone | string | Phone | No |
| department | string | Department,maximum 100 bit | No |
| avatar | string | Avatar, maximum 250 bit | No |
| unique_code | string | User unique code, maximum 50 bit | No |
Request Body Sample
{
"username": "test-name",
"real_name": "John",
"password": "123456",
"nickname": "Johny",
"gender": 1,
"email": "test@qq.com",
"phone": "15699999999",
"department":"Sales Department",
"avatar": "https://f-dev.clobotics.cn/4/0040ca4d85f5e5ef7354102f486ef843.jpg",
"unique_code": "uuytr"
}Response
Schema of data
| Name | Type | Description |
|---|---|---|
| id | int64 | User id |
| username | string | Login user name |
| real_name | string | Real name |
| password | string | Password |
| nickname | string | Nickname |
| gender | int32 | Gender, 1=male, 2=female |
| string | ||
| phone | string | Phone |
| department | string | Department |
| avatar | string | Avatar |
| unique_code | string | User unique code |
Response Body Sample
{
"code": 0,
"message": "",
"data": {
"id": 9837366,
"username": "test-name",
"real_name": "John",
"password": "123456",
"nickname": "Johny",
"gender": 1,
"email": "test@qq.com",
"phone": "15699999999",
"department":"Sales Department",
"avatar": "https://f-dev.clobotics.cn/4/0040ca4d85f5e5ef7354102f486ef843.jpg",
"unique_code": "uuytr"
}
}Query User
Description
Get user information based on user id
Request Config
| Config | Definition |
|---|---|
| URL | /user?user_id=2132&username=test |
| Method | GET |
Params
| Name | Type | Description | Required |
|---|---|---|---|
| user_id | int64 | User id, user id or name required | No |
| username | string | Username, user id or name required | No |
Response
Schema of data
| Name | Type | Description |
|---|---|---|
| id | int64 | User id |
| username | string | Login user name |
| real_name | string | Real name |
| nickname | string | Nickname |
| gender | int32 | Gender, 1=male, 2=female |
| string | ||
| phone | string | Phone |
| department | string | Department |
| avatar | string | Avatar |
| roles | []object | User role list (currently only one role) |
| + id | int64 | User role id |
| + name | string | User role name |
| + system_id | int64 | System id corresponding to the role |
| + order | int32 | Order |
| + description | string | Role description |
| orgs | []object | User organization list (currently only one organization) |
| + id | int64 | Organization id |
| + name | string | Organization name |
| + parent_id | int64 | Parent organization id |
Response Body Sample
{
"code": 0,
"message": "",
"data": {
"id": 9837366,
"username": "test-name",
"real_name": "John",
"nickname": "Johny",
"gender": 1,
"email": "test@qq.com",
"phone": "15699999999",
"department":"Sales Department",
"avatar": "https://f-dev.clobotics.cn/4/0040ca4d85f5e5ef7354102f486ef843.jpg",
"unique_code": "uuytr",
"roles": [
{
"id": 1256,
"name": "admin",
"code": "admin",
"system_id": 343,
"order": 1,
"description": "test"
}
],
"orgs": [
{
"id": 233,
"parent_id": 3232,
"name": "headquarter"
}
]
}
}Update User Info
Description
Update user info, all fields are required, we don't support update part of fields
Request Config
| Config | Definition |
|---|---|
| URL | /user |
| Method | PUT |
| Content-Type | application/json |
Request Body Schema
| Name | Type | Description | Required |
|---|---|---|---|
| id | int64 | User id,user id or name is required | No |
| username | string | User name,user id or name is required | No |
| real_name | string | Real name,maximum 100 bit | No |
| password | string | Password,maximum 200 bit | No |
| nickname | string | Nickname,maximum 100 bit | No |
| gender | int32 | Gender,1=male,2=female | No |
| string | No | ||
| phone | string | Phone | No |
| department | string | Department,maximum 100 bit | No |
| avatar | string | Avatar,maximum 250 bit | No |
| unique_code | string | User unique code, maximum 50 bit | No |
Request Body Sample
{
"id": 23,
"username": "test-name",
"real_name": "John",
"password": "123456",
"nickname": "Johny",
"gender": 1,
"email": "test@qq.com",
"phone": "15699999999",
"department":"Sales Department",
"avatar": "https://f-dev.clobotics.cn/4/0040ca4d85f5e5ef7354102f486ef843.jpg",
"unique_code": "uuytr"
}Response
Response Body Sample
{
"code": 0,
"message": ""
}Binding User Role
Description
Binding user role. Please check Role for role related information.
Notes:
- Currently only one user can be bound to one role.
Request Config
| Config | Definition |
|---|---|
| URL | /user/role |
| Method | POST |
| Content-Type | application/json |
Request Body Schema
| Name | Type | Description | Required |
|---|---|---|---|
| user_id | int64 | User id | Yes |
| role_id | int64 | Role id | Yes |
Request Body Sample
{
"user_id": 23,
"role_id": 232
}Response
Response Body Sample
{
"code": 0,
"message": ""
}Query User Role
Description
Query user binding role list.
Request Config
| Config | Definition |
|---|---|
| URL | /user/role?user_id=12 |
| Method | GET |
Params
| Name | Type | Description | Required |
|---|---|---|---|
| user_id | int64 | User id | Yes |
Response
Schema of data
| Name | Type | Description |
|---|---|---|
| user_id | int64 | User id |
| roles | []object | Role list |
| + id | int64 | Role id |
| + name | string | Role name |
| + system_id | int64 | System id |
| + order | int32 | Order |
| + description | string | Description |
Response Body Sample
{
"code": 0,
"message": "",
"data": {
"user_id": 12,
"roles": [
{
"id": 1256,
"name": "admin",
"system_id": 343,
"order": 1,
"description": "test"
}
]
}
}Unbinding User Role
Description
Unbinding user role. Please check Role for role related information.
Request Config
| Config | Definition |
|---|---|
| URL | /user/role?user_id=123&role_id=23 |
| Method | DELETE |
Params
| Name | Type | Description | Required |
|---|---|---|---|
| user_id | int64 | User id | Yes |
| role_id | int64 | Role id | Yes |
Response
Response Body Sample
{
"code": 0,
"message": ""
}Binding User Organization
Description
Binding user organization. Please check Organization for organization related information.
Notes:
- Currently only one user can be bound to one organization.
Request Config
| Config | Definition |
|---|---|
| URL | /user/org |
| Method | POST |
| Content-Type | application/json |
Request Body Schema
| Name | Type | Description | Required |
|---|---|---|---|
| user_id | int64 | User id | Yes |
| org_id | int64 | Organization id | Yes |
Request Body Sample
{
"user_id": 23,
"org_id": 232
}Response
Response Body Sample
{
"code": 0,
"message": ""
}Unbinding User Organization
Description
Unbinding user organization. Please check Organization for organization related information.
Request Config
| Config | Definition |
|---|---|
| URL | /user/org?user_id=123&org_id=23 |
| Method | DELETE |
Params
| Name | Type | Description | Required |
|---|---|---|---|
| user_id | int64 | User id | Yes |
| org_id | int64 | Organization id | Yes |
Response
Response Body Sample
{
"code": 0,
"message": ""
}Binding User Store
Description
Binding user with store. Please check Store for store related information.
Notes:
- Currently binding refers to business representative binding.
Request Config
| Config | Definition |
|---|---|
| URL | /user/store |
| Method | POST |
| Content-Type | application/json |
Request Body Schema
| Name | Type | Description | Required |
|---|---|---|---|
| user_id | int64 | User id | Yes |
| store_code | string | Store code | Yes |
Request Body Sample
{
"user_id": 23,
"store_code": "STORE_CODE"
}Response
Response Body Sample
{
"code": 0,
"message": ""
}Unbinding User Store
Description
Unbinding user with store. Please check Store for store related information.
Request Config
| Config | Definition |
|---|---|
| URL | /user/store?store_code=STORE_CODE&user_id=23 |
| Method | DELETE |
Params
| Name | Type | Description | Required |
|---|---|---|---|
| user_id | int64 | User id | Yes |
| store_code | string | Store code | Yes |
Response
Response Body Sample
{
"code": 0,
"message": ""
}Query User Binding Store
Description
Query all stores under the user (sales representative only currently).
Request Config
| Config | Definition |
|---|---|
| URL | /user/store?user_id=23 |
| Method | GET |
Params
| Name | Type | Description | Required |
|---|---|---|---|
| user_id | int64 | User id | Yes |
Response
Schema of data
| Name | Type | Description |
|---|---|---|
| code | string | Store code |
| name | string | Store name |
| address | string | Store address |
Response Body Sample
{
"code": 0,
"message": "",
"data": {
"stores": [
{
"code": "STORE_CODE",
"name": "Shantou store",
"address": "Daliao District, Shantou City, Guangdong Province"
}
]
}
}Batch update user store binding relationships
Description
The interface for batch updating store binding relationships supports both creating users and updating user information. Existing user and store binding relationships will be fully overwritten by new binding relationships.
Request Config
| Config | Definition |
|---|---|
| URL | /user/stores |
| Method | POST |
| Content-Type | application/json |
Params
| Name | Type | Description | Required |
|---|---|---|---|
| username | string | Login user name, maximum 50 bit | Yes |
| real_name | string | Real name, maximum 100 bit | No |
| password | string | Password, maximum 200 bit | No |
| phone | string | Phone | No |
| department | string | Department,maximum 100 bit | No |
| ext_info | string | Other additional information, the maximum length is 1000. It is recommended to use json format string data, such as: {"lead_phone":"18888888888","lead_real_name":"王五","lead_username":"wangwu","area_manager":"张三"} | No |
| store_codes | []string | Store code list. If not passed or null is passed, the binding relationship will not be updated. If an empty array is passed, all stores under the user will be unbound. If a store code list is passed, all store binding relationships of the user will be fully overwritten, and the existing binding relationships will be released. Stores must be created in advance through the store creation interface, otherwise an error will be returned that the store does not exist. Existing user and store binding relationships will be overwritten by the new relationship. | No |
Request Body Sample
{
"username": "testname",
"real_name": "zhangsan",
"password": "123456",
"phone": "15699999999",
"department":"Sales Department",
"ext_info":"{\"lead_phone\":\"18888888888\",\"lead_real_name\":\"王五\",\"lead_username\":\"wangwu\",\"area_manager\":\"张三\"}",
"store_codes": ["TEST001","TEST002","TEST003"]
}Response
Schema of data
| Name | Type | Description |
|---|---|---|
| id | int64 | User id |
| username | string | Login user name |
响应数据样例
{
"code": 0,
"message": "success",
"data": {
"id": 9837366,
"username": "testname"
}
}