In most cases, when an end user submits a support request by email, the email becomes a new ticket or adds a comment to an existing ticket. However, in certain cases, the email becomes a suspended ticket. It remains suspended until someone reviews the email and decides whether to accept or reject it. If no one reviews it, the email is deleted after 14 days.

You can use this API to list, recover, or delete suspended tickets. For more information about suspended tickets, seeUnderstanding and managing suspended tickets and spamandGuidelines for reviewing suspended ticketsin Zendesk help.

JSON format

Suspended Tickets are represented as JSON objects with the following properties:

Name Type Read-only Mandatory Description
attachments array true false The attachments, if any associated to this suspended ticket. SeeAttachments
author object true false The author id (if available), name and email
brand_id integer true false The id of the brand this ticket is associated with. Only applicable for Enterprise accounts
cause string true false Why the ticket was suspended
cause_id integer true false The ID of the cause
content string true false The content that was flagged
created_at string true false The ticket ID this suspended email is associated with, if available
error_messages array true false The error messages if any associated to this suspended ticket
id integer true false Automatically assigned
message_id string true false The ID of the email, if available
recipient string true false The original recipient e-mail address of the ticket
subject string true false The value of the subject field for this ticket
ticket_id integer true false The ticket ID this suspended email is associated with, if available
updated_at string true false When the ticket was assigned
url string true false The API url of this ticket
via object true false An object explaining how the ticket was created. See theVia object reference

Example

             
{"attachments":[],"author":{"email":"[email protected]","id":1111,"name":"Mr. Roboto"},"brand_id":123,"cause":"Detected as spam","cause_id":0,"content":"Out Of Office Reply","created_at":"2009-07-20T22:55:29Z","error_messages":null,"id":435,"message_id":"[email protected]","recipient":"[email protected]","subject":"Help, my printer is on fire!","ticket_id":67321,"updated_at":"2011-05-05T10:38:52Z","url":"https://example.zendesk.com/api/v2/tickets/35436.json","via":{"channel":"email","source":{"from":{"address":"[email protected]","name":"TotallyLegit"},"rel":null,"to":{"address":"[email protected]","name":"Example Account"}}}}

List Suspended Tickets

  • GET /api/v2/suspended_tickets

Allowed For

  • Unrestricted agents

Sorting

You can sort the tickets with thesort_byandsort_orderquery string parameters.

Parameters

Name Type In Required Description
sort_by string 查询 false The field to sort the ticket by, being one ofauthor_email,cause,created_at, orsubject.
sort_order string 查询 false The order in which to sort the suspended tickets. This can take valueascordesc.

代码示例

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/suspended_tickets.json\-v -u{email_address}:{password}
Go
              
import("fmt""io""net/http")funcmain(){url:="https://example.zendesk.com/api/v2/suspended_tickets?sort_by=author_email&sort_order=asc"method:="GET"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/suspended_tickets").newBuilder().addQueryParameter("sort_by","author_email").addQueryParameter("sort_order","asc");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("GET",null).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'GET',url:'https://example.zendesk.com/api/v2/suspended_tickets',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},params:{'sort_by':'author_email','sort_order':'asc',},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://example.zendesk.com/api/v2/suspended_tickets?sort_by=author_email&sort_order=asc"headers={"Content-Type":"application/json",}response=requests.request("GET",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://example.zendesk.com/api/v2/suspended_tickets")uri.query=URI.encode_www_form("sort_by":"author_email","sort_order":"asc")request=Net::HTTP::Get.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"suspended_tickets":[{"attachments":[],"author":{"email":"[email protected]","id":1,"name":"Mr. Roboto"},"brand_id":123,"cause":"Detected as spam","cause_id":0,"content":"Out Of Office Reply","created_at":"2009-07-20T22:55:29Z","error_messages":null,"id":435,"message_id":"[email protected]","recipient":"[email protected]","subject":"Help, my printer is on fire!","ticket_id":67321,"updated_at":"2011-05-05T10:38:52Z","url":"https://example.zendesk.com/api/v2/tickets/35436.json","via":{"channel":"email","source":{"from":{"address":"[email protected]","name":"TotallyLegit"},"rel":null,"to":{"address":"[email protected]","name":"Example Account"}}}},{"attachments":[],"author":{"email":"[email protected]","id":1,"name":"Mr. Roboto"},"brand_id":123,"cause":"Automated response mail","cause_id":0,"content":"Out Of Office Reply","created_at":"2009-07-20T22:55:29Z","error_messages":null,"id":207623,"message_id":"[email protected]","recipient":"[email protected]","subject":"Not just anybody!","ticket_id":67321,"updated_at":"2011-05-05T10:38:52Z","url":"https://example.zendesk.com/api/v2/tickets/35436.json","via":{"channel":"email","source":{"from":{"address":"[email protected]","name":"TotallyLegit"},"rel":null,"to":{"address":"[email protected]","name":"Example Account"}}}}]}

Show Suspended Ticket

  • GET /api/v2/suspended_tickets/{id}

Allowed For

  • Unrestricted agents

Parameters

Name Type In Required Description
id number Path true id of the suspended ticket

代码示例

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/suspended_tickets/{id}.json\-v -u{email_address}:{password}
Go
              
import("fmt""io""net/http")funcmain(){url:="https://example.zendesk.com/api/v2/suspended_tickets/35436"method:="GET"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/suspended_tickets/35436").newBuilder();Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("GET",null).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'GET',url:'https://example.zendesk.com/api/v2/suspended_tickets/35436',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://example.zendesk.com/api/v2/suspended_tickets/35436"headers={"Content-Type":"application/json",}response=requests.request("GET",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://example.zendesk.com/api/v2/suspended_tickets/35436")request=Net::HTTP::Get.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"suspended_tickets":[{"attachments":[],"author":{"email":"[email protected]","id":1,"name":"Mr. Roboto"},"brand_id":123,"cause":"Detected as spam","cause_id":0,"content":"Out Of Office Reply","created_at":"2009-07-20T22:55:29Z","error_messages":null,"id":435,"message_id":"[email protected]","recipient":"[email protected]","subject":"Help, my printer is on fire!","ticket_id":67321,"updated_at":"2011-05-05T10:38:52Z","url":"https://example.zendesk.com/api/v2/tickets/35436.json","via":{"channel":"email","source":{"from":{"address":"[email protected]","name":"TotallyLegit"},"rel":null,"to":{"address":"[email protected]","name":"Example Account"}}}},{"attachments":[],"author":{"email":"[email protected]","id":1,"name":"Mr. Roboto"},"brand_id":123,"cause":"Automated response mail","cause_id":0,"content":"Out Of Office Reply","created_at":"2009-07-20T22:55:29Z","error_messages":null,"id":207623,"message_id":"[email protected]","recipient":"[email protected]","subject":"Not just anybody!","ticket_id":67321,"updated_at":"2011-05-05T10:38:52Z","url":"https://example.zendesk.com/api/v2/tickets/35436.json","via":{"channel":"email","source":{"from":{"address":"[email protected]","name":"TotallyLegit"},"rel":null,"to":{"address":"[email protected]","name":"Example Account"}}}}]}

Recover Suspended Ticket

  • PUT /api/v2/suspended_tickets/{id}/recover

Note: During recovery, the API sets the requester to the authenticated agent who called the API, not the original requester. This prevents the ticket from being re-suspended after recovery. To preserve the original requester, use theRecover Multiple Suspended Ticketsendpoint with the single ticket.

Allowed For

  • Unrestricted agents

Parameters

Name Type In Required Description
id number Path true id of the suspended ticket

代码示例

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/suspended_tickets/{id}/recover.json\-v -u{email_address}:{password}-X PUT
Go
              
import("fmt""io""net/http")funcmain(){url:="https://example.zendesk.com/api/v2/suspended_tickets/35436/recover"method:="PUT"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/suspended_tickets/35436/recover").newBuilder();RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("PUT",body).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'PUT',url:'https://example.zendesk.com/api/v2/suspended_tickets/35436/recover',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://example.zendesk.com/api/v2/suspended_tickets/35436/recover"headers={"Content-Type":"application/json",}response=requests.request("PUT",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://example.zendesk.com/api/v2/suspended_tickets/35436/recover")request=Net::HTTP::Put.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"ticket":[{"author":{"email":"[email protected]","id":1,"name":"Mr. Roboto"},"brand_id":123,"cause":"Detected as spam","content":"Out Of Office Reply","created_at":"2009-07-20T22:55:29Z","id":3436,"recipient":"[email protected]","subject":"Help I need somebody!","ticket_id":67321,"updated_at":"2011-05-05T10:38:52Z","url":"https://example.zendesk.com/api/v2/tickets/35436.json","via":{"channel":"web"}}]}

Recover Multiple Suspended Tickets

  • PUT /api/v2/suspended_tickets/recover_many?ids={ids}

Accepts up to 100 ids (the auto-generated id, not the ticket id.) Note that suspended tickets that fail to be recovered are still included in the response.

Allowed For

  • Unrestricted agents

Parameters

Name Type In Required Description
ids string 查询 true A comma separated list of ids of suspended tickets to recover.

代码示例

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/suspended_tickets/recover_many.json?ids={id1},{id2}\-v -u{email_address}:{password}-X PUT
Go
              
import("fmt""io""net/http")funcmain(){url:="https://example.zendesk.com/api/v2/suspended_tickets/recover_many?ids=14%2C77"method:="PUT"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/suspended_tickets/recover_many").newBuilder().addQueryParameter("ids","14,77");RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("PUT",body).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'PUT',url:'https://example.zendesk.com/api/v2/suspended_tickets/recover_many',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},params:{'ids':'14%2C77',},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://example.zendesk.com/api/v2/suspended_tickets/recover_many?ids=14%2C77"headers={"Content-Type":"application/json",}response=requests.request("PUT",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://example.zendesk.com/api/v2/suspended_tickets/recover_many")uri.query=URI.encode_www_form("ids":"14,77")request=Net::HTTP::Put.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"tickets":[{"author":{"email":"[email protected]","id":1,"name":"Mr. Roboto"},"brand_id":123,"cause":"Detected as spam","content":"Out Of Office Reply","created_at":"2009-07-20T22:55:29Z","id":3436,"recipient":"[email protected]","subject":"Help I need somebody!","ticket_id":67321,"updated_at":"2011-05-05T10:38:52Z","url":"https://example.zendesk.com/api/v2/tickets/35436.json","via":{"channel":"web"}},{"author":{"email":"[email protected]","id":1,"name":"Mr. Roboto"},"brand_id":123,"cause":"Detected as spam","content":"Out Of Office Reply","created_at":"2009-07-20T22:55:29Z","id":3437,"recipient":"[email protected]","subject":"Not just anybody!","ticket_id":67321,"updated_at":"2011-05-05T10:38:52Z","url":"https://example.zendesk.com/api/v2/tickets/35436.json","via":{"channel":"web"}}]}

删除Suspended Ticket

  • DELETE /api/v2/suspended_tickets/{id}

Allowed For

  • Unrestricted agents

Parameters

Name Type In Required Description
id number Path true id of the suspended ticket

代码示例

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/suspended_tickets/{id}.json\-v -u{email_address}:{password}-X DELETE
Go
              
import("fmt""io""net/http")funcmain(){url:="https://example.zendesk.com/api/v2/suspended_tickets/35436"method:="DELETE"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/suspended_tickets/35436").newBuilder();Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("DELETE",null).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'DELETE',url:'https://example.zendesk.com/api/v2/suspended_tickets/35436',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://example.zendesk.com/api/v2/suspended_tickets/35436"headers={"Content-Type":"application/json",}response=requests.request("DELETE",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://example.zendesk.com/api/v2/suspended_tickets/35436")request=Net::HTTP::删除.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

204 No Content
              
// Status 204 No Contentnull

删除Multiple Suspended Tickets

  • DELETE /api/v2/suspended_tickets/destroy_many?ids={ids}

Accepts up to 100 ids (the auto-generated id, not the ticket id.)

Allowed For

  • Unrestricted agents

Parameters

Name Type In Required Description
ids string 查询 true A comma separated list of ids of suspended tickets to delete.

代码示例

curl
              
curlhttps://{subdomain}.亚博zendesk.com/api/v2/suspended_tickets/destroy_many.json?ids={id1},{id2}\-v -u{email_address}:{password}-X DELETE
Go
              
import("fmt""io""net/http")funcmain(){url:="https://example.zendesk.com/api/v2/suspended_tickets/destroy_many?ids=94%2C141"method:="DELETE"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/suspended_tickets/destroy_many").newBuilder().addQueryParameter("ids","94,141");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("DELETE",null).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'DELETE',url:'https://example.zendesk.com/api/v2/suspended_tickets/destroy_many',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},params:{'ids':'94%2C141',},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://example.zendesk.com/api/v2/suspended_tickets/destroy_many?ids=94%2C141"headers={"Content-Type":"application/json",}response=requests.request("DELETE",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://example.zendesk.com/api/v2/suspended_tickets/destroy_many")uri.query=URI.encode_www_form("ids":"94,141")request=Net::HTTP::删除.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

204 No Content
              
// Status 204 No Contentnull

Suspended Ticket Attachments

  • POST /api/v2/suspended_tickets/attachments

Makes copies of any attachments on a suspended ticket and returns them asattachment tokens. If the ticket is manually recovered, you can include the attachment tokens on the new ticket.

Allowed For

  • Unrestricted agents

Parameters

Name Type In Required Description
id number Path true id of the suspended ticket

代码示例

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/suspended_tickets/{id}/attachments.json\-v -u{email_address}:{password}-X POST
Go
              
import("fmt""io""net/http")funcmain(){url:="https://example.zendesk.com/api/v2/suspended_tickets/attachments"method:="POST"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/suspended_tickets/attachments").newBuilder();RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("POST",body).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'POST',url:'https://example.zendesk.com/api/v2/suspended_tickets/attachments',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://example.zendesk.com/api/v2/suspended_tickets/attachments"headers={"Content-Type":"application/json",}response=requests.request("POST",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://example.zendesk.com/api/v2/suspended_tickets/attachments")request=Net::HTTP::Post.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"upload":{"attachments":[{"content_type":"application/ics","content_url":"https://company.zendesk.com/attachments/token/tyBq1ms40dFaHefSIigxZpwGg/?name=calendar.ics","file_name":"calendar.ics","id":367,"size":1166,“thumbnails":[],"url":"https://company.zendesk.com/api/v2/attachments/367.json"}],"token":"yrznqgjoa24iw2f"}}

Export Suspended Tickets

  • POST /api/v2/suspended_tickets/export

Exports a list of suspended tickets for the Zendesk Support instance. To export the list, the endpoint enqueues a job to create a CSV file with the data. When done, Zendesk sends the requester an email containing a link to the CSV file. In the CSV, tickets are sorted by the update timestamp in ascending order.

Allowed For

  • Unrestricted agents

Rate limits

Limited to one request per minute and up to one million records in return. The rate-limiting mechanism behaves identically to the one described inUsage limits. We recommend using theRetry-Afterheader value as described inCatching errors caused by rate limiting.

代码示例

curl
              
curlhttps://{subdomain}.zendesk.com/api/v2/suspended_tickets/export.json\-v -u{email_address}:{password}-X POST
Go
              
import("fmt""io""net/http")funcmain(){url:="https://example.zendesk.com/api/v2/suspended_tickets/export"method:="POST"req,err:=http.NewRequest(method,url,nil)iferr!=nil{fmt.Println(err)return}req.Header.Add("Content-Type","application/json")req.Header.Add("Authorization","Basic ")// Base64 encoded "username:password"client:=&http.Client{}res,err:=client.Do(req)iferr!=nil{fmt.Println(err)return}deferres.Body.Close()body,err:=io.ReadAll(res.Body)iferr!=nil{fmt.Println(err)return}fmt.Println(string(body))}
Java
              
importcom.squareup.okhttp.*;OkHttpClientclient=newOkHttpClient();HttpUrl.BuilderurlBuilder=HttpUrl.parse("https://example.zendesk.com/api/v2/suspended_tickets/export").newBuilder();RequestBodybody=RequestBody.create(MediaType.parse("application/json"),"""""");Requestrequest=newRequest.Builder().url(urlBuilder.build()).method("POST",body).addHeader("Content-Type","application/json").addHeader("Authorization",Credentials.basic("your-email","your-password")).build();Responseresponse=client.newCall(request).execute();
Nodejs
              
varaxios=require('axios');varconfig={method:'POST',url:'https://example.zendesk.com/api/v2/suspended_tickets/export',headers:{'Content-Type':'application/json','Authorization':'Basic ',// Base64 encoded "username:password"},};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
Python
              
importrequestsurl="https://example.zendesk.com/api/v2/suspended_tickets/export"headers={"Content-Type":"application/json",}response=requests.request("POST",url,auth=('',''),headers=headers)print(response.text)
Ruby
              
require"net/http"uri=URI("https://example.zendesk.com/api/v2/suspended_tickets/export")request=Net::HTTP::Post.new(uri,"Content-Type":"application/json")request.basic_auth"username","password"response=Net::HTTP.start uri.hostname,uri.port,use_ssl:truedo|http|http.request(request)end

Example response(s)

200 OK
              
// Status 200 OK{"export":{"status":"enqueued","view_id":"suspended"}}