Skip to content

User

Create User

Description

Create a new user with the specified details.

Request Config

ConfigDefinition
URL/user
MethodPOST
Content-Typeapplication/json

Request Body Schema

NameTypeDescriptionRequired
usernamestringLogin user name, maximum 50 bitYes
real_namestringReal name, maximum 100 bitNo
passwordstringPassword, maximum 200 bitYes
nicknamestringNickname, maximum 100 bitNo
genderint32Gender, 1=male, 2=femaleNo
emailstringEmailNo
phonestringPhoneNo
departmentstringDepartment,maximum 100 bitNo
avatarstringAvatar, maximum 250 bitNo
unique_codestringUser unique code, maximum 50 bitNo

Request Body Sample

json
{
  "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

NameTypeDescription
idint64User id
usernamestringLogin user name
real_namestringReal name
passwordstringPassword
nicknamestringNickname
genderint32Gender, 1=male, 2=female
emailstringEmail
phonestringPhone
departmentstringDepartment
avatarstringAvatar
unique_codestringUser unique code

Response Body Sample

json
{
  "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

ConfigDefinition
URL/user?user_id=2132&username=test
MethodGET

Params

NameTypeDescriptionRequired
user_idint64User id, user id or name requiredNo
usernamestringUsername, user id or name requiredNo

Response


Schema of data

NameTypeDescription
idint64User id
usernamestringLogin user name
real_namestringReal name
nicknamestringNickname
genderint32Gender, 1=male, 2=female
emailstringEmail
phonestringPhone
departmentstringDepartment
avatarstringAvatar
roles[]objectUser role list (currently only one role)
+ idint64User role id
+ namestringUser role name
+ system_idint64System id corresponding to the role
+ orderint32Order
+ descriptionstringRole description
orgs[]objectUser organization list (currently only one organization)
+ idint64Organization id
+ namestringOrganization name
+ parent_idint64Parent organization id

Response Body Sample

json
{
  "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

ConfigDefinition
URL/user
MethodPUT
Content-Typeapplication/json

Request Body Schema

NameTypeDescriptionRequired
idint64User id,user id or name is requiredNo
usernamestringUser name,user id or name is requiredNo
real_namestringReal name,maximum 100 bitNo
passwordstringPassword,maximum 200 bitNo
nicknamestringNickname,maximum 100 bitNo
genderint32Gender,1=male,2=femaleNo
emailstringEmailNo
phonestringPhoneNo
departmentstringDepartment,maximum 100 bitNo
avatarstringAvatar,maximum 250 bitNo
unique_codestringUser unique code, maximum 50 bitNo

Request Body Sample

json
{
  "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

json
{
  "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

ConfigDefinition
URL/user/role
MethodPOST
Content-Typeapplication/json

Request Body Schema

NameTypeDescriptionRequired
user_idint64User idYes
role_idint64Role idYes

Request Body Sample

json
{
  "user_id": 23,
  "role_id": 232
}

Response


Response Body Sample

json
{
  "code": 0,
  "message": ""
}

Query User Role

Description

Query user binding role list.

Request Config

ConfigDefinition
URL/user/role?user_id=12
MethodGET

Params

NameTypeDescriptionRequired
user_idint64User idYes

Response


Schema of data

NameTypeDescription
user_idint64User id
roles[]objectRole list
+ idint64Role id
+ namestringRole name
+ system_idint64System id
+ orderint32Order
+ descriptionstringDescription

Response Body Sample

json
{
  "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

ConfigDefinition
URL/user/role?user_id=123&role_id=23
MethodDELETE

Params

NameTypeDescriptionRequired
user_idint64User idYes
role_idint64Role idYes

Response


Response Body Sample

json
{
  "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

ConfigDefinition
URL/user/org
MethodPOST
Content-Typeapplication/json

Request Body Schema

NameTypeDescriptionRequired
user_idint64User idYes
org_idint64Organization idYes

Request Body Sample

json
{
  "user_id": 23,
  "org_id": 232
}

Response


Response Body Sample

json
{
  "code": 0,
  "message": ""
}

Unbinding User Organization

Description

Unbinding user organization. Please check Organization for organization related information.

Request Config

ConfigDefinition
URL/user/org?user_id=123&org_id=23
MethodDELETE

Params

NameTypeDescriptionRequired
user_idint64User idYes
org_idint64Organization idYes

Response


Response Body Sample

json
{
  "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

ConfigDefinition
URL/user/store
MethodPOST
Content-Typeapplication/json

Request Body Schema

NameTypeDescriptionRequired
user_idint64User idYes
store_codestringStore codeYes

Request Body Sample

json
{
  "user_id": 23,
  "store_code": "STORE_CODE"
}

Response


Response Body Sample

json
{
  "code": 0,
  "message": ""
}

Unbinding User Store

Description

Unbinding user with store. Please check Store for store related information.

Request Config

ConfigDefinition
URL/user/store?store_code=STORE_CODE&user_id=23
MethodDELETE

Params

NameTypeDescriptionRequired
user_idint64User idYes
store_codestringStore codeYes

Response


Response Body Sample

json
{
  "code": 0,
  "message": ""
}

Query User Binding Store

Description

Query all stores under the user (sales representative only currently).

Request Config

ConfigDefinition
URL/user/store?user_id=23
MethodGET

Params

NameTypeDescriptionRequired
user_idint64User idYes

Response


Schema of data

NameTypeDescription
codestringStore code
namestringStore name
addressstringStore address

Response Body Sample

json
{
  "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

ConfigDefinition
URL/user/stores
MethodPOST
Content-Typeapplication/json

Params

NameTypeDescriptionRequired
usernamestringLogin user name, maximum 50 bitYes
real_namestringReal name, maximum 100 bitNo
passwordstringPassword, maximum 200 bitNo
phonestringPhoneNo
departmentstringDepartment,maximum 100 bitNo
ext_infostringOther 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[]stringStore 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

json
{
  "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

NameTypeDescription
idint64User id
usernamestringLogin user name

响应数据样例

json
{
  "code": 0,
  "message": "success",
  "data": {
    "id": 9837366,
    "username": "testname"
  }
}

Powered by Clobotics Retail Team.