遍历客户组
-
请求地址:
GET /customer_groups -
接口概述:
遍历客户组下的客户列表。
-
请求参数:
参数名 参数类型 参数说明 必需 备注 offset integer 响应结果起始下标 否 默认0 limit integer 响应结果的数量 否 默认50,最大1000 -
请求体:
无
-
请求示例:
GET /bitanswer/api/customer_groups HTTP/1.1 Host: back-office-api.bitanswer.cn bitkey: •••••• -
响应示例:
{ "status": 0, "data": { "total": 2, "items": [ { "name": "group_0" }, { "name": "group_1" } ] } }
查询客户组
-
请求地址:
POST /customer_groups/data -
接口概述:
根据限定的条件查询、排序符合的客户组。
-
请求参数:
参数名 参数类型 参数说明 必需 备注 offset integer 响应结果起始下标 否 默认0 limit integer 响应结果的数量 否 默认50,最大1000 -
请求体:
参数名 参数类型 参数说明 必需 备注 querys array 查询参数 否 sorts array 排序参数 否 querys
支持:
name。sorts
支持:
name。 -
请求示例
POST /bitanswer/api/customer_groups/data?offset={offset}&limit={limit} HTTP/1.1 Host: back-office-api.bitanswer.cn Content-Type: application/json bitkey: •••••• { "querys": [ { "name": "name", "op": "like", "values": [ "group%" ] } ], "sorts": [ { "name": "name" } ] } -
响应示例
{ "status": 0, "data": { "total": 1, "items": [ { "name": "group_test" } ] } }
创建客户组
-
请求地址:
POST /customer_groups -
接口概述:
创建客户组,已存在则跳过。
-
请求参数:
无
-
请求体:
参数名 参数类型 参数说明 必需 备注 name string 客户组名 是 -
请求示例:
POST /bitanswer/api/customer_groups HTTP/1.1 Host: back-office-api.bitanswer.cn Content-Type: application/json bitkey: •••••• { "name": "test_group" } -
响应示例:
{ "status": 0, "data": { "items": [ { "name": "test_group" } ] } }
按客户组名查询客户组
-
请求地址:
GET /customer_groups/{name} -
接口概述:
根据客户组名称查询指定客户组。
-
请求参数:
地址参数
参数名 参数类型 参数说明 必需 备注 name string 客户组名 是 -
请求体:
无
-
请求示例:
GET /bitanswer/api/customer_groups/{name} HTTP/1.1 Host: back-office-api.bitanswer.cn bitkey: •••••• -
响应示例:
{ "status": 0, "data": { "total": 1, "items": [ { "name": "group_test" } ] } }
按客户组名更新客户组
-
请求地址:
PATCH /customer_groups/{name}POST /customer_groups/{name}
-
接口概述:
按客户组名查找指定客户组,进行更新。
PATCH 方法和POST 方法都用于更新客户组名,首先根据客户组名查找指定客户组,若客户组不存在则报错;若客户组存在则修改客户组名。
-
请求参数:
地址参数
参数名 参数类型 参数说明 必需 备注 name string 客户组名 是 -
请求体:
参数名 参数类型 参数说明 必需 备注 name string 客户组名 否 -
请求示例:
PATCH /bitanswer/api/customer_groups/{name} HTTP/1.1 Host: back-office-api.bitanswer.cn Content-Type: application/json bitkey: •••••• { "name": "new_group_name" } -
响应示例:
{ "status": 0, "data": { "items": [ { "name": "new_group_name" } ] } }
按客户组名删除客户组
-
请求地址:
DELETE /customer_groups/{name} -
接口概述:
根据客户组名删除指定客户组。客户组下存在客户时不可删除。
-
请求参数:
地址参数
参数名 参数类型 参数说明 必需 备注 name string 客户组名 是 -
请求体:
无
-
请求示例:
DELETE /bitanswer/api/customer_groups/{name} HTTP/1.1 Host: back-office-api.bitanswer.cn bitkey: •••••• -
响应示例:
{ "status": 0, "data": { "items": [ { "name": "group_to_delete" } ] } }
遍历客户组下的客户
-
请求地址:
GET /customer_groups/{name}/customers -
接口概述:
遍历指定客户组下的客户。
-
请求参数:
参数名 参数类型 参数说明 必需 备注 offset integer 响应结果起始下标 否 默认0 limit integer 响应结果的数量 否 默认50,最大1000 地址参数
参数名 参数类型 参数说明 必需 备注 name string 客户组名 是 -
请求体:
无
-
请求示例:
GET /bitanswer/api/customer_groups/{name}/customers HTTP/1.1 Host: back-office-api.bitanswer.cn bitkey: •••••• -
响应示例:
{ "status": 0, "data": { "total": 2, "items": [ { "name": "customer_0", "groupName": "group_test" }, { "name": "customer_1", "groupName": "group_test" } ] } }
添加客户到客户组
-
请求地址:
POST /customer_groups/{name}/customers -
接口概述:
将客户添加到指定客户组。
-
请求参数:
地址参数
参数名 参数类型 参数说明 必需 备注 name string 客户组名 是 -
请求体:
参数名 参数类型 参数说明 必需 备注 name string 客户名 是 groupName string 原客户组 否 请求体以数组形式输入。
-
请求示例:
POST /bitanswer/api/customer_groups/{name}/customers HTTP/1.1 Host: back-office-api.bitanswer.cn Content-Type: application/json bitkey: •••••• [ { "name": "customer_0", "groupName": "客户组名" }, { "name": "customer_1", "groupName": "客户组名" } ] -
响应示例:
{ "status": 0, "data": { "items": [ { "name": "customer_0", "groupName": "group_test" }, { "name": "customer_1", "groupName": "group_test" } ] } }
从客户组移除客户
-
请求地址:
DELETE /customer_groups/{name}/customers -
接口概述:
将客户从指定客户组移除。
-
请求参数:
地址参数
参数名 参数类型 参数说明 必需 备注 name string 客户组名 是 -
请求体:
参数名 参数类型 参数说明 必需 备注 name string 客户名 是 groupName string 客户组名 否 请求体以数组形式输入。
-
请求示例:
DELETE /bitanswer/api/customer_groups/{name}/customers HTTP/1.1 Host: back-office-api.bitanswer.cn Content-Type: application/json bitkey: •••••• [ { "name": "customer_0", "groupName": "group_test" }, { "name": "customer_1", "groupName": "group_test" } ] -
响应示例:
{ "status": 0, "data": { "items": [ { "name": "customer_0" }, { "name": "customer_1" } ] } }