Recent searches
No recent searches
Bulk delete triggers API
Posted Feb 06, 2024
I followed the next documentation link to delete triggers in bulk. If I send the user & password this works fine, but if I send the token, the response is sending a 400 error and no trigger is deleted.
This is the code is failing:
curl --location --request DELETE 'https://{zendesk.domain}/api/v2/triggers/destroy_many?ids=360112475313' \--header 'Content-Type: application/json' \--header 'Authorization: Bearer MyToken' \--header 'Cookie: __cfruid=eb82143213a9f008f5a213c5181c4da44c6c8d34-1707230763; _zendesk_cookie=BAhJIhl7ImRldmljZV90b2tlbnMiOnt9fQY6BkVU--0bf2100788cb010d0183feca16aaf88ccaf719ca'
All other DELETE methods are working fine when using the bearer token.
Is this a bug or so I need to add some other info?
Regards.
0
9
9 comments
Chad Susa (Gravity CX - Zendesk Partner)
Hi Victor Cruz Gonzalez - That's great. Happy to help.
As for the different endpoints deleting and not deleting active triggers - good question. I have no idea. I think one of the API team would be best placed to answer this. On the surface it seems a bit weird that one will delete active triggers and the other doesn't.
Cheers
Chad
0
Victor Cruz Gonzalez
Chad Susa (Gravity CX - Zendesk Partner)
Just a query:
Why the DELETE trigger API (/api/v2/triggers/{trigger_id}) allows to delete an active trigger & DELETE bulk triggers (/api/v2/triggers/destroy_many?ids={ids}) doesn't?
0
Victor Cruz Gonzalez
Hi Chad Susa (Gravity CX - Zendesk Partner)
You're right! I need to deactivate all the triggers to be able to delete them in bulk! I was confused because the deleteTrigger API is able to delete the trigger even if it is active.
Thanks for your help!
0
Chad Susa (Gravity CX - Zendesk Partner)
Hi Victor Cruz Gonzalez
That error looks like an authentication error. Are you sure you have the correct credentials?
Also, when bulk deleting triggers, make sure the triggers you want to delete are deactivated first.
I tried my instance and bulk delete worked fine but the triggers had to be deactivated first. Also, the response is '204 no content'. The endpoint works but it just doesn't return any content.
0
Victor Cruz Gonzalez
Hi Greg Katechis, thanks for your response.
But it didn't worked :(
I also tried to do the authentication with username/token and the API token, using the without and with the .json, but it also fails.
Do you have any other suggestion?
Thanks for your help.
0
Greg Katechis
Hi Victor! Just a shot in the dark, since I have actually seen this cause issues in the past, could you append `.json` to `destroy_many` so that your url is `.../api/v2/triggers/destroy_many.json?ids=...`
I'm not sure why, but this has resolved similar issues, so it's worth a shot. Let me know if that works!
0
Victor Cruz Gonzalez
Hi Chad Susa (Gravity CX - Zendesk Partner), do you have any suggestions to solve the issue?
0
Victor Cruz Gonzalez
Hi Chad Susa (Gravity CX - Zendesk Partner)
I also tried with Postman. Below you can find the evidence:
I hope you can help me on this.
0
Chad Susa (Gravity CX - Zendesk Partner)
Hey Victor Cruz Gonzalez
I'm not much with curl but have you tried using Postman (you can use it for free) to run your API commands with Zendesk?
The best part is all the Support endpoints can be downloaded and 'uploaded' in postman as a collection...then you just set your authorisation and you have a very easy to work with tool on the Zendesk APIs.
When setting your authorisation for a Zendesk endpoint, use:
Type: Basic Auth
Username: {your email address}/token
Password: Your API token
I'd recommend using variables for these so it remains more secure across your Postman account.
I recommend to give it a go. Here is a little self made tutorial to maybe get you started. This page on Exploring the Zendesk API with postman is also great.
0
Sign in to leave a comment.