用户段
用户段定义了谁可以查看节或主题的内容。它可以指定以下任何访问限制:
您可以使用此API定义或更改用户段的访问限制。要将用户组应用于内容,请使用文章或主题API,并设置user_segment_id
财产。
JSON格式
用户段表示为JSON对象,具有以下属性:
的名字 | 类型 | 只读 | 强制性的 | 描述 |
---|---|---|---|---|
built_in | 布尔 | 真正的 | 假 | 是否内置用户段。内置用户段不支持修改 |
created_at | 字符串 | 真正的 | 假 | 创建用户段时 |
group_ids | 数组 | 假 | 假 | 具有访问权限的组的id |
id | 整数 | 真正的 | 假 | 创建用户段时自动分配 |
的名字 | 字符串 | 假 | 假 | 用户段名称(对于内置用户段,本地化为当前用户的语言环境) |
or_tags | 数组 | 假 | 假 | 用户必须在列表中至少有一个标记才能访问 |
organization_ids | 数组 | 假 | 假 | 具有访问权限的组织的id |
标签 | 数组 | 假 | 假 | 用户必须拥有的所有标签 |
updated_at | 字符串 | 真正的 | 假 | 用户段上次更新的时间 |
user_type | 字符串 | 假 | 真正的 | 可以查看内容的用户集 |
的user_type
属性接受以下值之一:
价值 | 用户 |
---|---|
signed_in_users | 只有经过认证的用户 |
工作人员 | 只有代理和帮助中心经理 |
为group_ids
,organization_ids
,标签
,or_tags
,空数组表示访问不受属性限制。例如,如果没有指定组id,那么用户不必属于任何特定的组就可以访问。
为标签
,用户必须拥有所有列出的标签才能访问。为or_tags
,用户必须至少有一个列出的标签才能访问。
例子
{
“built_in”:假,
“created_at”:“2017 - 07 - 20 - t22:55:29z”,
“group_ids”:[
12
],
“名称”:“VIP代理商”,
“organization_ids”:[
42
],
“标签”:[
“贵宾”
],
“updated_at”:“2017 - 07 - 23 t21:43:28z”,
“user_type”:“员工”
}
用户段列表
GET / api / v2 / help_center / user_segments
GET / api / v2 / help_center user_segments /适用
GET / api / v2 / help_center /用户/ {user_id} / user_segments
某些用户组只能应用于某些指南计划的部分和主题。例如,带有a的用户段user_type
的“员工”
不能应用于Guide Lite计划或Suite Team计划中关于帐户的部分和主题。若要仅请求适用于帐户当前套件计划的用户段,请使用/ api / v2 / help_center / user_segments / applicable.json
端点。
的/ api / v2 / help_center /用户/ {user_id} / user_segments.json
Endpoint返回特定用户所属的用户段列表。这是代理可以访问的唯一列表端点。当代理使用另一个用户的id向此端点发出请求时,响应只包括请求代理所属的用户段。
方法中描述的这些端点支持分页分页文件。
允许
- 帮助中心经理
- 代理
参数
的名字 | 类型 | 在 | 要求 | 描述 |
---|---|---|---|---|
built_in | 布尔 | 查询 | 假 | 如果为true,只能使用内置用户段;如果为false,只能使用自定义用户段 |
代码示例
旋度
旋度https://{子域名}.亚博zendesk.com/api/v2/help_center/user_segments.json\
- v - u{email_address}:{密码}
#只请求适用的用户段:
旋度https://{子域名}.亚博zendesk.com/api/v2/help_center/user_segments/applicable.json\
- v - u{email_address}:{密码}
去
进口(
“fmt”
“输入输出”
"net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/help_center/user_segments?built_in=”
方法:=“获得”
要求的事情,犯错:=http。NewRequest(方法,url,零)
如果犯错! =零{
fmt。Println(犯错)
返回
}
要求的事情。头。添加(“内容类型”,“application / json”)
要求的事情。头。添加(“授权”,“基本< auth-value >”)// Base64编码的"username:password"
客户端:=&http。客户端{}
res,犯错:=客户端。做(要求的事情)
如果犯错! =零{
fmt。Println(犯错)
返回
}
推迟res。身体。关闭()
身体,犯错:=io。ReadAll(res。身体)
如果犯错! =零{
fmt。Println(犯错)
返回
}
fmt。Println(字符串(身体))
}
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“得到”,
url:“https://support.亚博zendesk.com/api/v2/help_center/user_segments”,
头:{
“内容类型”:“application / json”,
“授权”:的基本< auth-value >”,// Base64编码的"username:password"
},
参数个数:{
“built_in”:”,
},
};
axios(配置)
。然后(函数(响应){
控制台。日志(JSON。stringify(响应。数据));
})
。抓(函数(错误){
控制台。日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/help_center/user_segments?built_in=”
头={
“内容类型”:“application / json”,
}
响应=请求。请求(
“获得”,
url,
身份验证=(“<用户名>”,' <密码> '),
头=头
)
打印(响应。文本)
Ruby
需要"net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/help_center/user_segments”)
uri。查询=URI。encode_www_form(“built_in”:"")
请求=网::HTTP::得到。新(uri,“内容类型”:“application / json”)
请求。basic_auth“用户名”,“密码”
响应=网::HTTP。开始uri。主机名,uri。港口,use_ssl:真正的做|http|
http。请求(请求)
结束
示例响应(年代)
200好了
// Status 200 OK
{
“user_segments”:[
{
“built_in”:假,
“created_at”:“2017 - 05 - 21 - t20:01:12z”,
“group_ids”:[
12
],
“id”:7284,
“名称”:“VIP代理商”,
“or_tags”:[],
“organization_ids”:[],
“标签”:[
“贵宾”
],
“updated_at”:“2017 - 06 - 30 t01:00:25z”,
“user_type”:“员工”
},
{
“built_in”:假,
“created_at”:“2017 - 04 - 09 - t15:33:11z”,
“group_ids”:[],
“id”:9930,
“名称”:“特权用户”,
“or_tags”:[],
“organization_ids”:[
42
],
“标签”:[],
“updated_at”:“2017 - 08 - 10 - t18:41:01z”,
“user_type”:“signed_in_users”
}
]
}
显示用户段
GET / api / v2 / help_center user_segments / {user_segment_id}
允许
- 帮助中心经理
参数
的名字 | 类型 | 在 | 要求 | 描述 |
---|---|---|---|---|
user_segment_id | 整数 | 路径 | 真正的 | 用户段的唯一ID |
代码示例
旋度
旋度https://{子域名}.亚博zendesk.com/api/v2/help_center/user_segments/{user_segment_id}. json\
- v - u{email_address}:{密码}
去
进口(
“fmt”
“输入输出”
"net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”
方法:=“获得”
要求的事情,犯错:=http。NewRequest(方法,url,零)
如果犯错! =零{
fmt。Println(犯错)
返回
}
要求的事情。头。添加(“内容类型”,“application / json”)
要求的事情。头。添加(“授权”,“基本< auth-value >”)// Base64编码的"username:password"
客户端:=&http。客户端{}
res,犯错:=客户端。做(要求的事情)
如果犯错! =零{
fmt。Println(犯错)
返回
}
推迟res。身体。关闭()
身体,犯错:=io。ReadAll(res。身体)
如果犯错! =零{
fmt。Println(犯错)
返回
}
fmt。Println(字符串(身体))
}
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“得到”,
url:“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”,
头:{
“内容类型”:“application / json”,
“授权”:的基本< auth-value >”,// Base64编码的"username:password"
},
};
axios(配置)
。然后(函数(响应){
控制台。日志(JSON。stringify(响应。数据));
})
。抓(函数(错误){
控制台。日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”
头={
“内容类型”:“application / json”,
}
响应=请求。请求(
“获得”,
url,
身份验证=(“<用户名>”,' <密码> '),
头=头
)
打印(响应。文本)
Ruby
需要"net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”)
请求=网::HTTP::得到。新(uri,“内容类型”:“application / json”)
请求。basic_auth“用户名”,“密码”
响应=网::HTTP。开始uri。主机名,uri。港口,use_ssl:真正的做|http|
http。请求(请求)
结束
示例响应(年代)
200好了
// Status 200 OK
{
“user_segment”:{
“built_in”:假,
“created_at”:“2017 - 05 - 21 - t20:01:12z”,
“group_ids”:[
12
],
“id”:7284,
“名称”:“VIP代理商”,
“or_tags”:[],
“organization_ids”:[],
“标签”:[
“贵宾”
],
“updated_at”:“2017 - 05 - 21 - t20:01:12z”,
“user_type”:“员工”
}
}
创建用户段
POST / api / v2 / help_center / user_segments
允许
- 帮助中心经理
代码示例
旋度
旋度https://{子域名}.亚博zendesk.com/api/v2/help_center/user_segments.json\
- d' {\
"user_segment": {\
“姓名”:“VIP代理”,\
"user_type": "staff", \
"group_ids":[12,…]), \
"tags": ["vip"] \
} \
} '\
- v - u{email_address}:{密码}-x post -h“application / json内容类型:
去
进口(
“fmt”
“输入输出”
"net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/help_center/user_segments”
方法:=“职位”
要求的事情,犯错:=http。NewRequest(方法,url,零)
如果犯错! =零{
fmt。Println(犯错)
返回
}
要求的事情。头。添加(“内容类型”,“application / json”)
要求的事情。头。添加(“授权”,“基本< auth-value >”)// Base64编码的"username:password"
客户端:=&http。客户端{}
res,犯错:=客户端。做(要求的事情)
如果犯错! =零{
fmt。Println(犯错)
返回
}
推迟res。身体。关闭()
身体,犯错:=io。ReadAll(res。身体)
如果犯错! =零{
fmt。Println(犯错)
返回
}
fmt。Println(字符串(身体))
}
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“职位”,
url:“https://support.亚博zendesk.com/api/v2/help_center/user_segments”,
头:{
“内容类型”:“application / json”,
“授权”:的基本< auth-value >”,// Base64编码的"username:password"
},
};
axios(配置)
。然后(函数(响应){
控制台。日志(JSON。stringify(响应。数据));
})
。抓(函数(错误){
控制台。日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/help_center/user_segments”
头={
“内容类型”:“application / json”,
}
响应=请求。请求(
“职位”,
url,
身份验证=(“<用户名>”,' <密码> '),
头=头
)
打印(响应。文本)
Ruby
需要"net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/help_center/user_segments”)
请求=网::HTTP::帖子。新(uri,“内容类型”:“application / json”)
请求。basic_auth“用户名”,“密码”
响应=网::HTTP。开始uri。主机名,uri。港口,use_ssl:真正的做|http|
http。请求(请求)
结束
示例响应(年代)
201年创建
//状态201已创建
{
“user_segment”:{
“built_in”:假,
“created_at”:“2017 - 05 - 21 - t20:01:12z”,
“group_ids”:[
12
],
“id”:7284,
“名称”:“VIP代理商”,
“or_tags”:[],
“organization_ids”:[],
“标签”:[
“贵宾”
],
“updated_at”:“2017 - 05 - 21 - t20:01:12z”,
“user_type”:“员工”
}
}
400错误请求
//状态400错误请求
{
“错误”:{
“user_type”:[
“foo值无效;必须是' staff '或' signed_in_users ' "
]
}
}
更新用户段
把/ api / v2 / help_center user_segments / {user_segment_id}
允许
- 帮助中心经理
参数
的名字 | 类型 | 在 | 要求 | 描述 |
---|---|---|---|---|
user_segment_id | 整数 | 路径 | 真正的 | 用户段的唯一ID |
代码示例
旋度
旋度https://{子域名}.亚博zendesk.com/api/v2/help_center/user_segments/{user_segment_id}. json\
- d' {\
"user_segment": {\
“姓名”:“VIP代理”,\
"user_type": "staff", \
"group_ids":[12,…]), \
"organization_ids":[42,…]), \
"tags": ["vip"] \
} \
} '\
- v - u{email_address}:{密码}-x乘以-h“application / json内容类型:
去
进口(
“fmt”
“输入输出”
"net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”
方法:=“把”
要求的事情,犯错:=http。NewRequest(方法,url,零)
如果犯错! =零{
fmt。Println(犯错)
返回
}
要求的事情。头。添加(“内容类型”,“application / json”)
要求的事情。头。添加(“授权”,“基本< auth-value >”)// Base64编码的"username:password"
客户端:=&http。客户端{}
res,犯错:=客户端。做(要求的事情)
如果犯错! =零{
fmt。Println(犯错)
返回
}
推迟res。身体。关闭()
身体,犯错:=io。ReadAll(res。身体)
如果犯错! =零{
fmt。Println(犯错)
返回
}
fmt。Println(字符串(身体))
}
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“把”,
url:“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”,
头:{
“内容类型”:“application / json”,
“授权”:的基本< auth-value >”,// Base64编码的"username:password"
},
};
axios(配置)
。然后(函数(响应){
控制台。日志(JSON。stringify(响应。数据));
})
。抓(函数(错误){
控制台。日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”
头={
“内容类型”:“application / json”,
}
响应=请求。请求(
“把”,
url,
身份验证=(“<用户名>”,' <密码> '),
头=头
)
打印(响应。文本)
Ruby
需要"net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”)
请求=网::HTTP::把。新(uri,“内容类型”:“application / json”)
请求。basic_auth“用户名”,“密码”
响应=网::HTTP。开始uri。主机名,uri。港口,use_ssl:真正的做|http|
http。请求(请求)
结束
示例响应(年代)
200好了
// Status 200 OK
{
“user_segment”:{
“built_in”:假,
“created_at”:“2017 - 05 - 21 - t20:01:12z”,
“group_ids”:[
12
],
“id”:7284,
“名称”:“VIP代理商”,
“or_tags”:[],
“organization_ids”:[],
“标签”:[
“贵宾”
],
“updated_at”:“2017 - 05 - 21 - t20:01:12z”,
“user_type”:“员工”
}
}
400错误请求
//状态400错误请求
{
“错误”:{
“user_type”:[
“foo值无效;必须是' staff '或' signed_in_users ' "
]
}
}
删除用户段
删除/ api / v2 / help_center user_segments / {user_segment_id}
允许
- 帮助中心经理
参数
的名字 | 类型 | 在 | 要求 | 描述 |
---|---|---|---|---|
user_segment_id | 整数 | 路径 | 真正的 | 用户段的唯一ID |
代码示例
旋度
旋度https://{子域名}.亚博zendesk.com/api/v2/help_center/user_segments/{user_segment_id}. json\
- v - u{email_address}:{密码}- x删除
去
进口(
“fmt”
“输入输出”
"net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”
方法:=“删除”
要求的事情,犯错:=http。NewRequest(方法,url,零)
如果犯错! =零{
fmt。Println(犯错)
返回
}
要求的事情。头。添加(“内容类型”,“application / json”)
要求的事情。头。添加(“授权”,“基本< auth-value >”)// Base64编码的"username:password"
客户端:=&http。客户端{}
res,犯错:=客户端。做(要求的事情)
如果犯错! =零{
fmt。Println(犯错)
返回
}
推迟res。身体。关闭()
身体,犯错:=io。ReadAll(res。身体)
如果犯错! =零{
fmt。Println(犯错)
返回
}
fmt。Println(字符串(身体))
}
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“删除”,
url:“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”,
头:{
“内容类型”:“application / json”,
“授权”:的基本< auth-value >”,// Base64编码的"username:password"
},
};
axios(配置)
。然后(函数(响应){
控制台。日志(JSON。stringify(响应。数据));
})
。抓(函数(错误){
控制台。日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”
头={
“内容类型”:“application / json”,
}
响应=请求。请求(
“删除”,
url,
身份验证=(“<用户名>”,' <密码> '),
头=头
)
打印(响应。文本)
Ruby
需要"net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234”)
请求=网::HTTP::删除。新(uri,“内容类型”:“application / json”)
请求。basic_auth“用户名”,“密码”
响应=网::HTTP。开始uri。主机名,uri。港口,use_ssl:真正的做|http|
http。请求(请求)
结束
示例响应(年代)
204无内容
//状态204无内容
零
用用户段列出部分
GET / api / v2 / help_center / user_segments / {user_segment_id} /部分
列出使用指定用户段的部分。
此端点支持中所述的分页分页。
允许
- 帮助中心经理
参数
的名字 | 类型 | 在 | 要求 | 描述 |
---|---|---|---|---|
user_segment_id | 整数 | 路径 | 真正的 | 用户段的唯一ID |
代码示例
旋度
旋度https://{子域名}.亚博zendesk.com/api/v2/help_center/user_segments/{user_segment_id}/ sections.json\
- v - u{email_address}:{密码}
去
进口(
“fmt”
“输入输出”
"net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234/sections”
方法:=“获得”
要求的事情,犯错:=http。NewRequest(方法,url,零)
如果犯错! =零{
fmt。Println(犯错)
返回
}
要求的事情。头。添加(“内容类型”,“application / json”)
要求的事情。头。添加(“授权”,“基本< auth-value >”)// Base64编码的"username:password"
客户端:=&http。客户端{}
res,犯错:=客户端。做(要求的事情)
如果犯错! =零{
fmt。Println(犯错)
返回
}
推迟res。身体。关闭()
身体,犯错:=io。ReadAll(res。身体)
如果犯错! =零{
fmt。Println(犯错)
返回
}
fmt。Println(字符串(身体))
}
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“得到”,
url:“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234/sections”,
头:{
“内容类型”:“application / json”,
“授权”:的基本< auth-value >”,// Base64编码的"username:password"
},
};
axios(配置)
。然后(函数(响应){
控制台。日志(JSON。stringify(响应。数据));
})
。抓(函数(错误){
控制台。日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234/sections”
头={
“内容类型”:“application / json”,
}
响应=请求。请求(
“获得”,
url,
身份验证=(“<用户名>”,' <密码> '),
头=头
)
打印(响应。文本)
Ruby
需要"net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234/sections”)
请求=网::HTTP::得到。新(uri,“内容类型”:“application / json”)
请求。basic_auth“用户名”,“密码”
响应=网::HTTP。开始uri。主机名,uri。港口,use_ssl:真正的做|http|
http。请求(请求)
结束
示例响应(年代)
200好了
// Status 200 OK
{
“部分”:[
{
“html_url”:“https://{子域名}.zendes亚博k.com/hc/en/sections/3242-A-section-”,
“id”:3242,
“场所”:“en”,
“名称”:“节”,
“url”:“https://{子域名}.zendes亚博k.com/api/v2/help_center/en/sections/3242-A-section-.json”
},
{
“html_url”:“https://{子域名}.zendes亚博k.com/hc/en/sections/7352-Another-section-”,
“id”:7352,
“场所”:“en”,
“名称”:另一个“节”,
“url”:“https://{子域名}.zendes亚博k.com/api/v2/help_center/en/sections/7352-Another-section-.json”
}
]
}
用用户段列出主题
GET / api / v2 / help_center / user_segments / {user_segment_id} /主题
列出使用指定用户段的主题。
此端点支持中所述的分页分页。
允许
- 帮助中心经理
参数
的名字 | 类型 | 在 | 要求 | 描述 |
---|---|---|---|---|
user_segment_id | 整数 | 路径 | 真正的 | 用户段的唯一ID |
代码示例
旋度
旋度https://{子域名}.亚博zendesk.com/api/v2/help_center/user_segments/{user_segment_id}/ topics.json\
- v - u{email_address}:{密码}
去
进口(
“fmt”
“输入输出”
"net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234/topics”
方法:=“获得”
要求的事情,犯错:=http。NewRequest(方法,url,零)
如果犯错! =零{
fmt。Println(犯错)
返回
}
要求的事情。头。添加(“内容类型”,“application / json”)
要求的事情。头。添加(“授权”,“基本< auth-value >”)// Base64编码的"username:password"
客户端:=&http。客户端{}
res,犯错:=客户端。做(要求的事情)
如果犯错! =零{
fmt。Println(犯错)
返回
}
推迟res。身体。关闭()
身体,犯错:=io。ReadAll(res。身体)
如果犯错! =零{
fmt。Println(犯错)
返回
}
fmt。Println(字符串(身体))
}
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“得到”,
url:“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234/topics”,
头:{
“内容类型”:“application / json”,
“授权”:的基本< auth-value >”,// Base64编码的"username:password"
},
};
axios(配置)
。然后(函数(响应){
控制台。日志(JSON。stringify(响应。数据));
})
。抓(函数(错误){
控制台。日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234/topics”
头={
“内容类型”:“application / json”,
}
响应=请求。请求(
“获得”,
url,
身份验证=(“<用户名>”,' <密码> '),
头=头
)
打印(响应。文本)
Ruby
需要"net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/help_center/user_segments/1234/topics”)
请求=网::HTTP::得到。新(uri,“内容类型”:“application / json”)
请求。basic_auth“用户名”,“密码”
响应=网::HTTP。开始uri。主机名,uri。港口,use_ssl:真正的做|http|
http。请求(请求)
结束
示例响应(年代)
200好了
// Status 200 OK
{
“主题”:[
{
“html_url”:“https://{子域名}.zendes亚博k.com/hc/en/community/topics/9273-A-topic-”,
“id”:9273,
“名称”:“一个主题”,
“url”:“https://{子域名}.zendes亚博k.com/api/v2/community/topics/9273.json”
},
{
“html_url”:“https://{子域名}.zendes亚博k.com/hc/en/community/topics/2292-Another-topic-”,
“id”:2292,
“名称”:另一个“主题”,
“url”:“https://{子域名}.zendes亚博k.com/api/v2/community/topics/2292-Another-topic-.json”
}
]
}