Push Notification Devices
A push notification device is a mobile device identifier used by the Zendesk Support SDK to send push notifications.
Bulk Unregister Push Notification Devices
POST /api/v2/push_notification_devices/destroy_many
Unregisters the mobile devices that are receiving push notifications. Specify the devices as an array of mobile device tokens.
Allowed for
- Admins
Example body
{"push_notification_devices": ["token1","token2"]}
Code Samples
cURL
curl -X "POST" "https://{subdomain}.zendesk.com/api/v2/push_notification_devices/destroy_many" \-H "Authorization: Bearer {access_token}" \-H "Content-Type: application/json" \-H "Accept: application/json" \-d '{ "push_notification_devices": ["token1", "token2"] }'
Go
import ("fmt""io""net/http""strings")func main() {url := "https://example.zendesk.com/api/v2/push_notification_devices/destroy_many"method := "POST"payload := strings.NewReader(`{"push_notification_devices": ["token1","token2"]}`)req, err := http.NewRequest(method, url, payload)if err != nil {fmt.Println(err)return}req.Header.Add("Authorization", "Bearer ${authToken}")req.Header.Add("Content-Type", "application/json")client := &http.Client {}res, err := client.Do(req)if err != nil {fmt.Println(err)return}defer res.Body.Close()body, err := io.ReadAll(res.Body)if err != nil {fmt.Println(err)return}fmt.Println(string(body))}
Java
import com.squareup.okhttp.*;OkHttpClient client = new OkHttpClient();HttpUrl.Builder urlBuilder = HttpUrl.parse("https://example.zendesk.com/api/v2/push_notification_devices/destroy_many").newBuilder();RequestBody body = RequestBody.create(MediaType.parse("application/json"),"""{\"push_notification_devices\": [\"token1\",\"token2\"]}""");Request request = new Request.Builder().url(urlBuilder.build()).method("POST", body).addHeader("Authorization", "Bearer ${authToken}").addHeader("Content-Type", "application/json").build();Response response = client.newCall(request).execute();
Nodejs
var axios = require('axios');var data = JSON.stringify({"push_notification_devices": ["token1","token2"]});var config = {method: 'POST',url: 'https://example.zendesk.com/api/v2/push_notification_devices/destroy_many',headers: {'Authorization': 'Bearer ${authToken}','Content-Type': 'application/json',},data : data,};axios(config).then(function (response) {console.log(JSON.stringify(response.data));}).catch(function (error) {console.log(error);});
Python
import requestsimport jsonurl = "https://example.zendesk.com/api/v2/push_notification_devices/destroy_many"payload = json.loads("""{"push_notification_devices": ["token1","token2"]}""")headers = {"Authorization": "Bearer ${authToken}","Content-Type": "application/json",}response = requests.request("POST",url,headers=headers,json=payload)print(response.text)
Ruby
require "net/http"uri = URI("https://example.zendesk.com/api/v2/push_notification_devices/destroy_many")request = Net::HTTP::Post.new(uri, "Authorization": "Bearer ${authToken}", "Content-Type": "application/json")request.body = %q({"push_notification_devices": ["token1","token2"]})response = Net::HTTP.start uri.hostname, uri.port, use_ssl: true do |http|http.request(request)end
Example response(s)
200 OK
// Status 200 OKnull