代理的可用性
代理的可用性包括它们的状态、分配给它们的工作项以及每个通道的最大容量。
JSON格式
代理可用性表示为具有以下属性的JSON对象:
名字 | 类型 | 只读 | 强制性的 | 描述 |
---|---|---|---|---|
属性 | 对象 | 假 | 真正的 | 座席可用性属性. |
id | 字符串 | 假 | 真正的 | 代理的JSON:API ID。 |
链接 | 对象 | 假 | 真正的 | 链接到代理的可用性。 |
的关系 | 对象 | 假 | 假 | 一个对象的关系包含钥匙渠道 ,其值为通道亚博电脑端资源。 |
类型 | 字符串 | 假 | 真正的 | JSON:API类型agent_availabilities . |
答案是a复合文档.对于每个通道,类型的资源渠道
将被包含,并将引用与通道关联的工作项的第一页。这些工作项资源(类型为亚博电脑端work_items
)亦会包括在回应内。要为通道请求工作项的下一页或上一页,请使用所提供的分页链接。工作项按它们被添加的时间排序,并按时间顺序返回。
例子
{
“属性”:{
“agent_id”:10011,
“agent_status”:{
“id”:1,
“名称”:“在线”,
“updated_at”:“2022 - 06 - 21 t10:23:25.583732z”
},
“版本”:236
},
“id”:“agent_availabilities | 10011”,
“链接”:{
“自我”:“https://example.亚博zendesk.com/api/v2/agent_availabilities/10011”
},
“关系”:{
“通道”:{
“数据”:[
{
“id”:“agent_availabilities | 10011 |频道|消息”,
“类型”:“通道”
},
{
“id”:“agent_availabilities | 10011 |频道|交谈”,
“类型”:“通道”
}
]
}
},
“类型”:“agent_availabilities”
}
获取代理的可用性
GET / api / v2 / agent_availabilities / {agent_id}
返回指定代理的可用性。
允许
- 管理员
参数
名字 | 类型 | 在 | 要求 | 描述 |
---|---|---|---|---|
agent_id | 整数 | 路径 | 真正的 | 座席的Zendesk I亚博D。 |
代码示例
旋度
Curl -v -u {email_address}:{password} \
“https://example.亚博zendesk.com/api/v2/agent_availabilities/10011”
去
进口(
“fmt”
“输入输出”
“net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011”
方法:=“获得”
要求的事情,犯错:=http.NewRequest(方法,url,零)
如果犯错! =零{
fmt.Println(犯错)
返回
}
要求的事情.头.添加(“接受”,“application / json”)
要求的事情.头.添加(“亚博Zendesk-Api-Version”,“2023-02-01”)
要求的事情.头.添加(“内容类型”,“application / json”)
客户端:=&http.客户端{}
res,犯错:=客户端.做(要求的事情)
如果犯错! =零{
fmt.Println(犯错)
返回
}
推迟res.身体.关闭()
身体,犯错:=io.ReadAll(res.身体)
如果犯错! =零{
fmt.Println(犯错)
返回
}
fmt.Println(字符串(身体))
}
Java
进口com.squareup.okhttp.*;
OkHttpClient客户端=新OkHttpClient();
HttpUrl.构建器urlBuilder=HttpUrl.解析(“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011”)
.newBuilder();
请求请求=新请求.构建器()
.url(urlBuilder.构建())
.方法(“获得”,零)
.addHeader(“接受”,“application / json”)
.addHeader(“亚博Zendesk-Api-Version”,“2023-02-01”)
.addHeader(“内容类型”,“application / json”)
.构建();
响应响应=客户端.newCall(请求).执行();
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“得到”,
url:“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011”,
头:{
“接受”:“application / json”,
“亚博Zendesk-Api-Version”:“2023-02-01”,
“内容类型”:“application / json”,
},
};
axios(配置)
.然后(函数(响应){
控制台.日志(JSON.stringify(响应.数据));
})
.抓(函数(错误){
控制台.日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011”
头={
“接受”:“application / json”,
“亚博Zendesk-Api-Version”:“2023-02-01”,
“内容类型”:“application / json”,
}
响应=请求.请求(
“获得”,
url,
头=头
)
打印(响应.文本)
鲁比(人名)
需要“net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011”)
请求=网::HTTP::得到.新(uri,“接受”:“application / json”,“亚博Zendesk-Api-Version”:“2023-02-01”,“内容类型”:“application / json”)
响应=网::HTTP.开始uri.主机名,uri.港口,use_ssl:真正的做|http|
http.请求(请求)
结束
示例响应(年代)
200好了
//状态200 OK
{
“数据”:{
“属性”:{
“agent_id”:10011,
“agent_status”:{
“id”:1,
“名称”:“在线”,
“updated_at”:“2022 - 06 - 21 t10:23:25.583732z”
},
“版本”:236
},
“id”:“agent_availabilities | 10011”,
“链接”:{
“自我”:“https://example.亚博zendesk.com/api/v2/agent_availabilities/10011”
},
“关系”:{
“通道”:{
“数据”:[
{
“id”:“agent_availabilities | 10011 |频道|消息”,
“类型”:“通道”
},
{
“id”:“agent_availabilities | 10011 |频道|交谈”,
“类型”:“通道”
}
]
}
},
“类型”:“agent_availabilities”
},
“包括”:[
{
“属性”:{
“max_capacity”:1,
“名称”:“消息”,
“状态”:“在线”,
“updated_at”:“2022 - 06 - 21 t10:23:25.583732z”,
“work_item_count”:5
},
“id”:“agent_availabilities | 10011 |频道|消息”,
“关系”:{
“work_items”:{
“数据”:[
{
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 201”,
“类型”:“work_items”
},
{
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 202”,
“类型”:“work_items”
},
{
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 203”,
“类型”:“work_items”
}
],
“链接”:{
“下一个”:“https://example.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/messaging/relationships/work_items?page%5Bafter%5D=203”
},
“元”:{
“has_more”:真正的
}
}
},
“类型”:“通道”
},
{
“属性”:{
“max_capacity”:2,
“名称”:“交谈”,
“状态”:“在线”,
“updated_at”:“2022 - 06 - 21 t10:23:42.260756z”,
“work_item_count”:1
},
“id”:“agent_availabilities | 10011 |频道|交谈”,
“关系”:{
“work_items”:{
“数据”:[
{
“id”:“agent_availabilities | 10011 |频道| |说话work_items | 301”,
“类型”:“work_items”
}
],
“链接”:{},
“元”:{
“has_more”:假
}
}
},
“类型”:“通道”
},
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:20:44.798006z”
},
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 201”,
“类型”:“work_items”
},
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:20:57.928097z”
},
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 202”,
“类型”:“work_items”
},
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:21:10.778364z”
},
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 203”,
“类型”:“work_items”
},
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:21:25.609509z”
},
“id”:“agent_availabilities | 10011 |频道| |说话work_items | 301”,
“类型”:“work_items”
}
]
}
400错误请求
//状态400错误请求
{
“错误”:[
{
“代码”:“InvalidParameter”,
“细节”:“agent_id必须是一个长正整数”,
“源”:{
“参数”:“agent_id”
},
“标题”:“坏请求”
}
]
}
401年未经授权
//状态401未授权
{
“错误”:[
{
“代码”:“InvalidCredentials”,
“标题”:“未经授权的”
}
]
}
403年被禁止的
//状态403禁止
{
“错误”:[
{
“代码”:“InvalidPermissions”,
“标题”:“禁止”
}
]
}
404未找到
//状态404未找到
{
“错误”:[
{
“代码”:“AgentNotFound”,
“细节”:"找不到代理人",
“源”:{
“参数”:“agent_id”
},
“标题”:“没有找到”
}
]
}
406不接受
//状态406不可接受
{
“错误”:[
{
“代码”:“NotAcceptable”,
“标题”:“不可接受”
}
]
}
请求太多
//状态429请求过多
{
“错误”:[
{
“代码”:“TooManyRequests”,
“标题”:“请求太多”
}
]
}
500服务器内部错误
//状态500服务器内部错误
{
“错误”:[
{
“代码”:“InternalServerError”,
“标题”:"内部服务器错误"
}
]
}
获取代理可用性
GET / api / v2 / agent_availabilities
在没有查询参数的情况下,请求与该帐户关联的所有代理的可用性。参数可用于根据通道状态进行过滤(例如:过滤器[channel_status] =消息:在线
)和/或工作项计数(例如:过滤器(work_items_count) =消息:3
),以及代理状态id(例如:过滤器(agent_status_id) = 1
)和代理状态名称(例如:过滤器[agent_status_name] = "在线"
)。
当使用过滤器[work_items_count]时,查询将返回工作项数量小于或等于指定数量的代理。
代理状态过滤器与逻辑或相结合。同一通道的状态也与逻辑或组合在一起。然后将过滤器与逻辑与组合起来。
例如,使用查询参数? [channel_status] =消息过滤:online&filter [work_items_count] =消息:1过滤器[channel_status] =谈话:online&filter [work_items_count] =谈话:1过滤器[agent_status_name] =“在线”、“离线”
时,请求将返回对Messaging和Talk都处于联机状态的代理,这些代理至少有一个工作项分配给每个通道,并且其代理状态为联机或脱机。
若要仅为一个通道返回特定于通道的数据,请将通道名称作为查询参数的值提交select_channel
.
代理可用性以依赖于实现的顺序返回,并进行分页。要导航到结果的下一页或上一页,请使用分页的链接提供,其中使用页面(前)
和页面(后)
参数。
允许
- 管理员
参数
名字 | 类型 | 在 | 要求 | 描述 |
---|---|---|---|---|
过滤器(agent_status_id) | 字符串 | 查询 | 假 | 一个过滤器,其列表是一个以逗号分隔的代理状态id列表。 |
过滤器(agent_status_name) | 字符串 | 查询 | 假 | 一个过滤器,其值是一个以逗号分隔的代理状态名列表,每个状态名都用双引号括起来(" )。反斜杠(\ )可用于转义代理状态名中的双引号或反斜杠。 |
过滤器(channel_status) | 字符串 | 查询 | 假 | 一个过滤器,其值是格式通道:status中以逗号分隔的元素列表。 |
过滤器(work_items_count) | 字符串 | 查询 | 假 | 一个过滤器,其值是格式通道中以逗号分隔的元素列表:workItemsCount。 |
页面(后) | 字符串 | 查询 | 假 | 返回的游标下一个 前面响应中的链接。 |
页面(前) | 字符串 | 查询 | 假 | 返回的游标上一页 前面响应中的链接。 |
页面(大小) | 整数 | 查询 | 假 | 要返回的代理可用性的最大数目。 |
select_channel | 字符串 | 查询 | 假 | 如果提供,响应将只包含指定通道的特定于通道的数据。 |
代码示例
旋度
Curl -v -u {email_address}:{password} \
“https://example.亚博zendesk.com/api/v2/agent_availabilities?filter [channel_status] =消息:online&filter [work_items_count] =消息:1过滤器[channel_status] =说:online&filter [work_items_count] =说:1 '
去
进口(
“fmt”
“输入输出”
“net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/agent_availabilities?filter [agent_status_id] = 123% 2 c134&filter [agent_status_name] = % 5 c % 22在线% 5 c % 22% 2 c % 5 c % 22日会议% 5 c&filter [channel_status] =消息% 3 aonline % 2 csupport % 3 aonline&filter [work_items_count] =消息% 3 a3 % 2 csupport % 3 a2&page[在]= 10011 _0&page[在]= 10011 _0&page(大小)= 20 &select_channel =消息”
方法:=“获得”
要求的事情,犯错:=http.NewRequest(方法,url,零)
如果犯错! =零{
fmt.Println(犯错)
返回
}
要求的事情.头.添加(“接受”,“application / json”)
要求的事情.头.添加(“亚博Zendesk-Api-Version”,“2023-02-01”)
要求的事情.头.添加(“内容类型”,“application / json”)
客户端:=&http.客户端{}
res,犯错:=客户端.做(要求的事情)
如果犯错! =零{
fmt.Println(犯错)
返回
}
推迟res.身体.关闭()
身体,犯错:=io.ReadAll(res.身体)
如果犯错! =零{
fmt.Println(犯错)
返回
}
fmt.Println(字符串(身体))
}
Java
进口com.squareup.okhttp.*;
OkHttpClient客户端=新OkHttpClient();
HttpUrl.构建器urlBuilder=HttpUrl.解析(“https://support.亚博zendesk.com/api/v2/agent_availabilities”)
.newBuilder()
.addQueryParameter(“过滤器(agent_status_id)”,“123134”)
.addQueryParameter(“过滤器(agent_status_name)”,在线\“\,\ \“会议”)
.addQueryParameter(“过滤器(channel_status)”,“消息:在线支持:在线”)
.addQueryParameter(“过滤器(work_items_count)”,“消息传递:3,支持:2”)
.addQueryParameter(“页面(后)”,“10011 _0”)
.addQueryParameter(“页面(前)”,“10011 _0”)
.addQueryParameter(“页面大小”,“20”)
.addQueryParameter(“select_channel”,“消息”);
请求请求=新请求.构建器()
.url(urlBuilder.构建())
.方法(“获得”,零)
.addHeader(“接受”,“application / json”)
.addHeader(“亚博Zendesk-Api-Version”,“2023-02-01”)
.addHeader(“内容类型”,“application / json”)
.构建();
响应响应=客户端.newCall(请求).执行();
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“得到”,
url:“https://support.亚博zendesk.com/api/v2/agent_availabilities”,
头:{
“接受”:“application / json”,
“亚博Zendesk-Api-Version”:“2023-02-01”,
“内容类型”:“application / json”,
},
参数个数:{
“过滤器(agent_status_id)”:“123% 2 c134”,
“过滤器(agent_status_name)”:' % 5 c % 22在线% 5 c % 22% 2 c % 5 c % 22日会议% 5 c ',
“过滤器(channel_status)”:“消息% 3 aonline % 2 csupport % 3 aonline”,
“过滤器(work_items_count)”:“消息% 3 a3 % 2 csupport % 3 a2”,
的页面(后):“10011 _0”,
的页面(前):“10011 _0”,
页面(大小)的:“20”,
“select_channel”:“消息”,
},
};
axios(配置)
.然后(函数(响应){
控制台.日志(JSON.stringify(响应.数据));
})
.抓(函数(错误){
控制台.日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/agent_availabilities?filter [agent_status_id] = 123% 2 c134&filter [agent_status_name] = % 5 c % 22在线% 5 c % 22% 2 c % 5 c % 22日会议% 5 c&filter [channel_status] =消息% 3 aonline % 2 csupport % 3 aonline&filter [work_items_count] =消息% 3 a3 % 2 csupport % 3 a2&page[在]= 10011 _0&page[在]= 10011 _0&page(大小)= 20 &select_channel =消息”
头={
“接受”:“application / json”,
“亚博Zendesk-Api-Version”:“2023-02-01”,
“内容类型”:“application / json”,
}
响应=请求.请求(
“获得”,
url,
头=头
)
打印(响应.文本)
鲁比(人名)
需要“net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/agent_availabilities”)
uri.查询=URI.encode_www_form(“过滤器(agent_status_id)”:“123134”,“过滤器(agent_status_name)”:会议在线”\“\”,\“\”、“过滤器[channel_status]”:“消息传递:在线,支持:在线”、“过滤器[work_items_count]”:“消息传递:3.,支持:2”、“页面[后]”:“10011 - 1 _0”、“页面[之前]”:“10011 - 1 _0”、“页面[大小]”:“20.”、“select_channel”:“消息”)
请求=网::HTTP::得到.新(uri,“接受”:“application / json”,“亚博Zendesk-Api-Version”:“2023-02-01”,“内容类型”:“application / json”)
响应=网::HTTP.开始uri.主机名,uri.港口,use_ssl:真正的做|http|
http.请求(请求)
结束
示例响应(年代)
200好了
//状态200 OK
{
“数据”:[
{
“属性”:{
“agent_id”:10011,
“agent_status”:{
“id”:1,
“名称”:“在线”,
“updated_at”:“2022 - 06 - 21 t10:23:25.583732z”
},
“版本”:236
},
“id”:“agent_availabilities | 10011”,
“链接”:{
“自我”:“https://example.亚博zendesk.com/api/v2/agent_availabilities/10011”
},
“关系”:{
“通道”:{
“数据”:[
{
“id”:“agent_availabilities | 10011 |频道|消息”,
“类型”:“通道”
},
{
“id”:“agent_availabilities | 10011 |频道|交谈”,
“类型”:“通道”
}
]
}
},
“类型”:“agent_availabilities”
},
{
“属性”:{
“agent_id”:10012,
“agent_status”:{
“id”:1,
“名称”:“在线”,
“updated_at”:“2022 - 06 - 21 t10:23:25.583732z”
},
“版本”:875
},
“id”:“agent_availabilities | 10012”,
“链接”:{
“自我”:“https://example.亚博zendesk.com/api/v2/agent_availabilities/10012”
},
“关系”:{
“通道”:{
“数据”:[
{
“id”:“agent_availabilities | 10012 |频道|消息”,
“类型”:“通道”
},
{
“id”:“agent_availabilities | 10012 |频道|交谈”,
“类型”:“通道”
}
]
}
},
“类型”:“agent_availabilities”
}
],
“包括”:[
{
“属性”:{
“max_capacity”:1,
“名称”:“消息”,
“状态”:“在线”,
“updated_at”:“2022 - 06 - 21 t10:23:25.583732z”,
“work_item_count”:5
},
“id”:“agent_availabilities | 10011 |频道|消息”,
“关系”:{
“work_items”:{
“数据”:[
{
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 201”,
“类型”:“work_items”
},
{
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 202”,
“类型”:“work_items”
},
{
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 203”,
“类型”:“work_items”
}
],
“链接”:{
“下一个”:“https://example.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/messaging/relationships/work_items?page%5Bafter%5D=203”
},
“元”:{
“has_more”:真正的
}
}
},
“类型”:“通道”
},
{
“属性”:{
“max_capacity”:2,
“名称”:“交谈”,
“状态”:“在线”,
“updated_at”:“2022 - 06 - 21 t10:23:42.260756z”,
“work_item_count”:1
},
“id”:“agent_availabilities | 10011 |频道|交谈”,
“关系”:{
“work_items”:{
“数据”:[
{
“id”:“agent_availabilities | 10011 |频道| |说话work_items | 301”,
“类型”:“work_items”
}
],
“链接”:{},
“元”:{
“has_more”:假
}
}
},
“类型”:“通道”
},
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:20:44.798006z”
},
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 201”,
“类型”:“work_items”
},
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:20:57.928097z”
},
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 202”,
“类型”:“work_items”
},
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:21:10.778364z”
},
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 203”,
“类型”:“work_items”
},
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:21:25.609509z”
},
“id”:“agent_availabilities | 10011 |频道| |说话work_items | 301”,
“类型”:“work_items”
},
{
“属性”:{
“max_capacity”:2,
“名称”:“消息”,
“状态”:“在线”,
“updated_at”:“2022 - 07 - 27 t16:06:52.344273z”,
“work_item_count”:1
},
“id”:“agent_availabilities | 10012 |频道|消息”,
“关系”:{
“work_items”:{
“数据”:[
{
“id”:“agent_availabilities | 10012 |频道|消息| work_items | 401”,
“类型”:“work_items”
}
],
“链接”:{},
“元”:{
“has_more”:假
}
}
},
“类型”:“通道”
},
{
“属性”:{
“max_capacity”:1,
“名称”:“交谈”,
“状态”:“在线”,
“updated_at”:“2022 - 07 - 27 t16:04:49.119790z”,
“work_item_count”:1
},
“id”:“agent_availabilities | 10012 |频道|交谈”,
“关系”:{
“work_items”:{
“数据”:[
{
“id”:“agent_availabilities | 10012 |频道| |说话work_items | 501”,
“类型”:“work_items”
}
],
“链接”:{},
“元”:{
“has_more”:假
}
}
},
“类型”:“通道”
},
{
“属性”:{
“added_at”:“2022 - 07 - 27 t16:06:26.762432z”
},
“id”:“agent_availabilities | 10012 |频道|消息| work_items | 401”,
“类型”:“work_items”
},
{
“属性”:{
“added_at”:“2022 - 07 - 27 t15:59:20.849756z”
},
“id”:“agent_availabilities | 10012 |频道| |说话work_items | 501”,
“类型”:“work_items”
}
],
“链接”:{
“下一个”:“https://example.亚博zendesk.com/api/v2/agent_availabilities?page%5Bafter%5D=10012_0”,
“上一页”:“https://example.亚博zendesk.com/api/v2/agent_availabilities?page%5Bbefore%5D=10011_0”
},
“元”:{
“has_more”:真正的
}
}
400错误请求
//状态400错误请求
{
“错误”:[
{
“代码”:“InvalidParameter”,
“细节”:“agent_id必须是一个长正整数”,
“源”:{
“参数”:“agent_id”
},
“标题”:“坏请求”
}
]
}
401年未经授权
//状态401未授权
{
“错误”:[
{
“代码”:“InvalidCredentials”,
“标题”:“未经授权的”
}
]
}
403年被禁止的
//状态403禁止
{
“错误”:[
{
“代码”:“InvalidPermissions”,
“标题”:“禁止”
}
]
}
404未找到
//状态404未找到
{
“错误”:[
{
“代码”:“AgentNotFound”,
“细节”:"找不到代理人",
“源”:{
“参数”:“agent_id”
},
“标题”:“没有找到”
}
]
}
406不接受
//状态406不可接受
{
“错误”:[
{
“代码”:“NotAcceptable”,
“标题”:“不可接受”
}
]
}
请求太多
//状态429请求过多
{
“错误”:[
{
“代码”:“TooManyRequests”,
“标题”:“请求太多”
}
]
}
500服务器内部错误
//状态500服务器内部错误
{
“错误”:[
{
“代码”:“InternalServerError”,
“标题”:"内部服务器错误"
}
]
}
获取代理分配的工作项
GET / api / v2 / agent_availabilities / {agent_id} /通道/{频道}/ / work_items的关系
在没有查询参数的情况下,返回为指定通道分配给代理的工作项的第一页。要导航到工作项的下一页或上一页,请使用分页的链接提供,其中使用页面(前)
和页面(后)
参数。
工作项按它们被添加的时间排序,并在默认情况下按时间顺序返回。要按时间倒序返回它们,请使用参数类型= -added_at
.
允许
- 管理员
参数
名字 | 类型 | 在 | 要求 | 描述 |
---|---|---|---|---|
页面(后) | 字符串 | 查询 | 假 | 返回的游标下一个 前面响应中的链接。 |
页面(前) | 字符串 | 查询 | 假 | 返回的游标上一页 前面响应中的链接。 |
页面(大小) | 整数 | 查询 | 假 | 要返回的工作项的最大数量。 |
排序 | 字符串 | 查询 | 假 | 工作项的排序顺序(added_at 按时间顺序或-added_at 时间倒序为默认值added_at )。 |
agent_id | 整数 | 路径 | 真正的 | 座席的Zendesk I亚博D。 |
通道 | 字符串 | 路径 | 真正的 | 通道名。 |
代码示例
旋度
Curl -v -u {email_address}:{password} \
“https://example.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/talk/relationships/work_items?page%5Bafter%5D=203&sort=added_at”
去
进口(
“fmt”
“输入输出”
“net/http”
)
函数主要(){
url:=“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/messaging/relationships/work_items?page[在]= 9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced&page[在]= 9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced&page(大小)= 20种= -added_at”
方法:=“获得”
要求的事情,犯错:=http.NewRequest(方法,url,零)
如果犯错! =零{
fmt.Println(犯错)
返回
}
要求的事情.头.添加(“接受”,“application / json”)
要求的事情.头.添加(“亚博Zendesk-Api-Version”,“2023-02-01”)
要求的事情.头.添加(“内容类型”,“application / json”)
客户端:=&http.客户端{}
res,犯错:=客户端.做(要求的事情)
如果犯错! =零{
fmt.Println(犯错)
返回
}
推迟res.身体.关闭()
身体,犯错:=io.ReadAll(res.身体)
如果犯错! =零{
fmt.Println(犯错)
返回
}
fmt.Println(字符串(身体))
}
Java
进口com.squareup.okhttp.*;
OkHttpClient客户端=新OkHttpClient();
HttpUrl.构建器urlBuilder=HttpUrl.解析(“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/messaging/relationships/work_items”)
.newBuilder()
.addQueryParameter(“页面(后)”,“9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced”)
.addQueryParameter(“页面(前)”,“9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced”)
.addQueryParameter(“页面大小”,“20”)
.addQueryParameter(“排序”,“-added_at”);
请求请求=新请求.构建器()
.url(urlBuilder.构建())
.方法(“获得”,零)
.addHeader(“接受”,“application / json”)
.addHeader(“亚博Zendesk-Api-Version”,“2023-02-01”)
.addHeader(“内容类型”,“application / json”)
.构建();
响应响应=客户端.newCall(请求).执行();
Nodejs
varaxios=需要(“axios”);
var配置={
方法:“得到”,
url:“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/messaging/relationships/work_items”,
头:{
“接受”:“application / json”,
“亚博Zendesk-Api-Version”:“2023-02-01”,
“内容类型”:“application / json”,
},
参数个数:{
的页面(后):“9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced”,
的页面(前):“9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced”,
页面(大小)的:“20”,
“排序”:“-added_at”,
},
};
axios(配置)
.然后(函数(响应){
控制台.日志(JSON.stringify(响应.数据));
})
.抓(函数(错误){
控制台.日志(错误);
});
Python
进口请求
url=“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/messaging/relationships/work_items?page[在]= 9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced&page[在]= 9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced&page(大小)= 20种= -added_at”
头={
“接受”:“application / json”,
“亚博Zendesk-Api-Version”:“2023-02-01”,
“内容类型”:“application / json”,
}
响应=请求.请求(
“获得”,
url,
头=头
)
打印(响应.文本)
鲁比(人名)
需要“net/http”
uri=URI(“https://support.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/messaging/relationships/work_items”)
uri.查询=URI.encode_www_form(“页面(后)”:“9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced”,“页面(前)”:“9 ed76ce4 - 577 d - 435 - c - 8402 - 755 - f7d401ced”,“页面大小”:“20”,“排序”:“-added_at”)
请求=网::HTTP::得到.新(uri,“接受”:“application / json”,“亚博Zendesk-Api-Version”:“2023-02-01”,“内容类型”:“application / json”)
响应=网::HTTP.开始uri.主机名,uri.港口,use_ssl:真正的做|http|
http.请求(请求)
结束
示例响应(年代)
200好了
//状态200 OK
{
“数据”:[
{
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 202”,
“类型”:“work_items”
},
{
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 203”,
“类型”:“work_items”
}
],
“包括”:[
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:21:58.636732z”
},
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 202”,
“类型”:“work_items”
},
{
“属性”:{
“added_at”:“2022 - 06 - 21 t10:22:18.484395z”
},
“id”:“agent_availabilities | 10011 |频道|消息| work_items | 203”,
“类型”:“work_items”
}
],
“链接”:{
“下一个”:“https://example.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/messaging/relationships/work_items?page%5Bafter%5D=203”,
“上一页”:“https://example.亚博zendesk.com/api/v2/agent_availabilities/10011/channels/messaging/relationships/work_items?page%5Bbefore%5D=202”
},
“元”:{
“has_more”:真正的
}
}
400错误请求
//状态400错误请求
{
“错误”:[
{
“代码”:“InvalidParameter”,
“细节”:“agent_id必须是一个长正整数”,
“源”:{
“参数”:“agent_id”
},
“标题”:“坏请求”
}
]
}
401年未经授权
//状态401未授权
{
“错误”:[
{
“代码”:“InvalidCredentials”,
“标题”:“未经授权的”
}
]
}
403年被禁止的
//状态403禁止
{
“错误”:[
{
“代码”:“InvalidPermissions”,
“标题”:“禁止”
}
]
}
404未找到
//状态404未找到
{
“错误”:[
{
“代码”:“AgentNotFound”,
“细节”:"找不到代理人",
“源”:{
“参数”:“agent_id”
},
“标题”:“没有找到”
}
]
}
406不接受
//状态406不可接受
{
“错误”:[
{
“代码”:“NotAcceptable”,
“标题”:“不可接受”
}
]
}
请求太多
//状态429请求过多
{
“错误”:[
{
“代码”:“TooManyRequests”,
“标题”:“请求太多”
}
]
}
500服务器内部错误
//状态500服务器内部错误
{
“错误”:[
{
“代码”:“InternalServerError”,
“标题”:"内部服务器错误"
}
]
}