推送通知设备
推送通知设备是Zendesk Support SDK用于发送推送通知的移动设备标识符。亚博
批量注销推送通知设备
POST / api / v2 / push_notification_devices / destroy_many
注销正在接收推送通知的移动设备。将设备指定为移动设备令牌数组。
允许
- 管理员
例子的身体
{
“push_notification_devices”:[
“token1”,
“token2”
]
}
代码示例
旋度
旋度- x“职位”“https://{子域名}.zendes亚博k.com/api/v2/push_notification_devices/destroy_many.json”\
- u{email_address}:{密码}\
- h“application / json内容类型:\
- h“接受:application / json”\
- d{"push_notification_devices": ["token1", "token2"]} "
去
进口(
“fmt”
“输入输出”
“net/http”
“弦”
)
函数主要(){
url:=“https://example.亚博zendesk.com/api/v2/push_notification_devices/destroy_many”
方法:=“职位”
有效载荷:=字符串.NewReader(”{
“push_notification_devices”:(
“token1”,
“token2”
]
} ')
要求的事情,犯错:=http.NewRequest(方法,url,有效载荷)
如果犯错! =零{
fmt.Println(犯错)
返回
}
要求的事情.头.添加(“内容类型”,“application / json”)
要求的事情.头.添加(“授权”,“基本< auth-value >”)// Base64编码的"username:password"
客户端:=&http.客户端{}
res,犯错:=客户端.做(要求的事情)
如果犯错! =零{
fmt.Println(犯错)
返回
}
推迟res.身体.关闭()
身体,犯错:=io.ReadAll(res.身体)
如果犯错! =零{
fmt.Println(犯错)
返回
}
fmt.Println(字符串(身体))
}
Java
进口com.squareup.okhttp.*;
OkHttpClient客户端=新OkHttpClient();
HttpUrl.构建器urlBuilder=HttpUrl.解析(“https://example.亚博zendesk.com/api/v2/push_notification_devices/destroy_many”)
.newBuilder();
RequestBody身体=RequestBody.创建(MediaType.解析(“application / json”),
"""
{
push_notification_devices \“\”:[
token1 \“\”,
token2 \“\”
]
}""");
请求请求=新请求.构建器()
.url(urlBuilder.构建())
.方法(“职位”,身体)
.addHeader(“内容类型”,“application / json”)
.addHeader(“授权”,凭证.基本(“电子邮件”,“你的密码”))
.构建();
响应响应=客户端.newCall(请求).执行();
Nodejs
varaxios=需要(“axios”);
var数据=JSON.stringify({
“push_notification_devices”:[
“token1”,
“token2”
]
});
var配置={
方法:“职位”,
url:“https://example.亚博zendesk.com/api/v2/push_notification_devices/destroy_many”,
头:{
“内容类型”:“application / json”,
“授权”:的基本< auth-value >”,// Base64编码的"username:password"
},
数据:数据,
};
axios(配置)
.然后(函数(响应){
控制台.日志(JSON.stringify(响应.数据));
})
.抓(函数(错误){
控制台.日志(错误);
});
Python
进口请求
进口json
url=“https://example.亚博zendesk.com/api/v2/push_notification_devices/destroy_many”
有效载荷=json.加载(”““{
“push_notification_devices”:(
“token1”,
“token2”
]
}”“”)
头={
“内容类型”:“application / json”,
}
响应=请求.请求(
“职位”,
url,
身份验证=(“<用户名>”,' <密码> '),
头=头,
json=有效载荷
)
打印(响应.文本)
鲁比(人名)
需要“net/http”
uri=URI(“https://example.亚博zendesk.com/api/v2/push_notification_devices/destroy_many”)
请求=网::HTTP::帖子.新(uri,“内容类型”:“application / json”)
请求.身体=%问({
“push_notification_devices”:[
“token1”,
“token2”
]
})
请求.basic_auth“用户名”,“密码”
响应=网::HTTP.开始uri.主机名,uri.港口,use_ssl:真正的做|http|
http.请求(请求)
结束
示例响应(年代)
200好了
// Status 200 OK
零