Go / Support API / Recover Multiple Suspended Tickets
Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global_Ref.html">Global Unlock Sample for sample code.
http := chilkat.NewHttp()
var success bool
http.SetBasicAuth(true)
http.SetLogin("login")
http.SetPassword("password")
http.SetRequestHeader("Accept","application/json")
resp := http.QuickRequest("PUT","https://example.zendesk.com/api/v2/suspended_tickets/recover_many?ids=<string>")
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
return
}
sbResponseBody := chilkat.NewStringBuilder()
resp.GetBodySb(sbResponseBody)
jResp := chilkat.NewJsonObject()
jResp.LoadSb(sbResponseBody)
jResp.SetEmitCompact(false)
fmt.Println("Response Body:")
fmt.Println(*jResp.Emit())
respStatusCode := resp.StatusCode()
fmt.Println("Response Status Code = ", respStatusCode)
if respStatusCode >= 400 {
fmt.Println("Response Header:")
fmt.Println(resp.Header())
fmt.Println("Failed.")
resp.DisposeHttpResponse()
http.DisposeHttp()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()
return
}
resp.DisposeHttpResponse()
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "tickets": [
// {
// "attachments": [
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>",
// "thumbnails": [
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>"
// },
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>"
// }
// ]
// },
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>",
// "thumbnails": [
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>"
// },
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>"
// }
// ]
// }
// ],
// "author": {
// "email": "<string>",
// "id": "<integer>",
// "name": "<string>"
// },
// "brand_id": "<integer>",
// "cause": "<string>",
// "cause_id": "<integer>",
// "content": "<string>",
// "created_at": "<dateTime>",
// "id": "<integer>",
// "message_id": "<string>",
// "recipient": "<string>",
// "subject": "<string>",
// "ticket_id": "<integer>",
// "updated_at": "<dateTime>",
// "url": "<string>",
// "via": {
// "channel": "<string>",
// "source": {
// "from": {
// "address": "<string>",
// "id": "<integer>",
// "name": "<string>",
// "title": "<string>"
// },
// "rel": "<string>",
// "to": {
// "address": "<string>",
// "name": "<string>"
// },
// "dolore58f": -60495356.51097781
// }
// }
// },
// {
// "attachments": [
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>",
// "thumbnails": [
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>"
// },
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>"
// }
// ]
// },
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>",
// "thumbnails": [
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>"
// },
// {
// "content_type": "<string>",
// "content_url": "<string>",
// "deleted": "<boolean>",
// "file_name": "<string>",
// "height": "<string>",
// "id": "<integer>",
// "inline": "<boolean>",
// "malware_access_override": "<boolean>",
// "malware_scan_result": "<string>",
// "mapped_content_url": "<string>",
// "size": "<integer>",
// "url": "<string>",
// "width": "<string>"
// }
// ]
// }
// ],
// "author": {
// "email": "<string>",
// "id": "<integer>",
// "name": "<string>"
// },
// "brand_id": "<integer>",
// "cause": "<string>",
// "cause_id": "<integer>",
// "content": "<string>",
// "created_at": "<dateTime>",
// "id": "<integer>",
// "message_id": "<string>",
// "recipient": "<string>",
// "subject": "<string>",
// "ticket_id": "<integer>",
// "updated_at": "<dateTime>",
// "url": "<string>",
// "via": {
// "channel": "<string>",
// "source": {
// "from": {
// "address": "<string>",
// "id": "<integer>",
// "name": "<string>",
// "title": "<string>"
// },
// "rel": "<string>",
// "to": {
// "address": "<string>",
// "name": "<string>"
// }
// }
// }
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
var v_Email_Ref.html">Email *string = new(string)
var Id *string = new(string)
var Name *string = new(string)
var brand_id *string = new(string)
var cause *string = new(string)
cause_ var id *string = new(string)
var content *string = new(string)
var created_at *string = new(string)
var id *string = new(string)
message_ var id *string = new(string)
var recipient *string = new(string)
var subject *string = new(string)
ticket_ var id *string = new(string)
var updated_at *string = new(string)
var url *string = new(string)
var Channel *string = new(string)
var Address *string = new(string)
var FromId *string = new(string)
var FromName *string = new(string)
var Title *string = new(string)
var Rel *string = new(string)
To var Address *string = new(string)
var ToName *string = new(string)
var Dolore58f *string = new(string)
var j int
var count_j int
var content_type *string = new(string)
content_ var url *string = new(string)
var deleted *string = new(string)
var file_name *string = new(string)
var height *string = new(string)
var inline *string = new(string)
var malware_access_override *string = new(string)
var malware_scan_result *string = new(string)
mapped_content_ var url *string = new(string)
var size *string = new(string)
var width *string = new(string)
var k int
var count_k int
i := 0
count_i := jResp.SizeOfArray("tickets")
for i < count_i {
jResp.SetI(i)
v_Email_Ref.html">Email = jResp.StringOf("tickets[i].author.email")
Id = jResp.StringOf("tickets[i].author.id")
Name = jResp.StringOf("tickets[i].author.name")
brand_id = jResp.StringOf("tickets[i].brand_id")
cause = jResp.StringOf("tickets[i].cause")
cause_id = jResp.StringOf("tickets[i].cause_id")
content = jResp.StringOf("tickets[i].content")
created_at = jResp.StringOf("tickets[i].created_at")
id = jResp.StringOf("tickets[i].id")
message_id = jResp.StringOf("tickets[i].message_id")
recipient = jResp.StringOf("tickets[i].recipient")
subject = jResp.StringOf("tickets[i].subject")
ticket_id = jResp.StringOf("tickets[i].ticket_id")
updated_at = jResp.StringOf("tickets[i].updated_at")
url = jResp.StringOf("tickets[i].url")
Channel = jResp.StringOf("tickets[i].via.channel")
Address = jResp.StringOf("tickets[i].via.source.from.address")
FromId = jResp.StringOf("tickets[i].via.source.from.id")
FromName = jResp.StringOf("tickets[i].via.source.from.name")
Title = jResp.StringOf("tickets[i].via.source.from.title")
Rel = jResp.StringOf("tickets[i].via.source.rel")
ToAddress = jResp.StringOf("tickets[i].via.source.to.address")
ToName = jResp.StringOf("tickets[i].via.source.to.name")
Dolore58f = jResp.StringOf("tickets[i].via.source.dolore58f")
j = 0
count_j = jResp.SizeOfArray("tickets[i].attachments")
for j < count_j {
jResp.SetJ(j)
content_type = jResp.StringOf("tickets[i].attachments[j].content_type")
content_url = jResp.StringOf("tickets[i].attachments[j].content_url")
deleted = jResp.StringOf("tickets[i].attachments[j].deleted")
file_name = jResp.StringOf("tickets[i].attachments[j].file_name")
height = jResp.StringOf("tickets[i].attachments[j].height")
id = jResp.StringOf("tickets[i].attachments[j].id")
inline = jResp.StringOf("tickets[i].attachments[j].inline")
malware_access_override = jResp.StringOf("tickets[i].attachments[j].malware_access_override")
malware_scan_result = jResp.StringOf("tickets[i].attachments[j].malware_scan_result")
mapped_content_url = jResp.StringOf("tickets[i].attachments[j].mapped_content_url")
size = jResp.StringOf("tickets[i].attachments[j].size")
url = jResp.StringOf("tickets[i].attachments[j].url")
width = jResp.StringOf("tickets[i].attachments[j].width")
k = 0
count_k = jResp.SizeOfArray("tickets[i].attachments[j].thumbnails")
for k < count_k {
jResp.SetK(k)
content_type = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].content_type")
content_url = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].content_url")
deleted = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].deleted")
file_name = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].file_name")
height = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].height")
id = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].id")
inline = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].inline")
malware_access_override = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].malware_access_override")
malware_scan_result = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].malware_scan_result")
mapped_content_url = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].mapped_content_url")
size = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].size")
url = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].url")
width = jResp.StringOf("tickets[i].attachments[j].thumbnails[k].width")
k = k + 1
}
j = j + 1
}
i = i + 1
}
http.DisposeHttp()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()
Curl Command
curl -u login:password -X PUT
-H "Accept: application/json"
https://example.zendesk.com/api/v2/suspended_tickets/recover_many?ids=<string>
Postman Collection Item JSON
{
"name": "Recover Multiple Suspended Tickets",
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/suspended_tickets/recover_many?ids=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"suspended_tickets",
"recover_many"
],
"query": [
{
"key": "ids",
"value": "<string>",
"description": "(Required) A comma separated list of ids of suspended tickets to recover."
}
]
},
"description": "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.\n\n#### Allowed For\n\n* Unrestricted agents\n"
},
"response": [
{
"name": "Success response",
"originalRequest": {
"method": "PUT",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/suspended_tickets/recover_many?ids=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"suspended_tickets",
"recover_many"
],
"query": [
{
"key": "ids",
"value": "<string>",
"description": "(Required) A comma separated list of ids of suspended tickets to recover."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"tickets\": [\n {\n \"attachments\": [\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\",\n \"thumbnails\": [\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\"\n },\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\"\n }\n ]\n },\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\",\n \"thumbnails\": [\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\"\n },\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\"\n }\n ]\n }\n ],\n \"author\": {\n \"email\": \"<string>\",\n \"id\": \"<integer>\",\n \"name\": \"<string>\"\n },\n \"brand_id\": \"<integer>\",\n \"cause\": \"<string>\",\n \"cause_id\": \"<integer>\",\n \"content\": \"<string>\",\n \"created_at\": \"<dateTime>\",\n \"id\": \"<integer>\",\n \"message_id\": \"<string>\",\n \"recipient\": \"<string>\",\n \"subject\": \"<string>\",\n \"ticket_id\": \"<integer>\",\n \"updated_at\": \"<dateTime>\",\n \"url\": \"<string>\",\n \"via\": {\n \"channel\": \"<string>\",\n \"source\": {\n \"from\": {\n \"address\": \"<string>\",\n \"id\": \"<integer>\",\n \"name\": \"<string>\",\n \"title\": \"<string>\"\n },\n \"rel\": \"<string>\",\n \"to\": {\n \"address\": \"<string>\",\n \"name\": \"<string>\"\n },\n \"dolore58f\": -60495356.51097781\n }\n }\n },\n {\n \"attachments\": [\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\",\n \"thumbnails\": [\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\"\n },\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\"\n }\n ]\n },\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\",\n \"thumbnails\": [\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\"\n },\n {\n \"content_type\": \"<string>\",\n \"content_url\": \"<string>\",\n \"deleted\": \"<boolean>\",\n \"file_name\": \"<string>\",\n \"height\": \"<string>\",\n \"id\": \"<integer>\",\n \"inline\": \"<boolean>\",\n \"malware_access_override\": \"<boolean>\",\n \"malware_scan_result\": \"<string>\",\n \"mapped_content_url\": \"<string>\",\n \"size\": \"<integer>\",\n \"url\": \"<string>\",\n \"width\": \"<string>\"\n }\n ]\n }\n ],\n \"author\": {\n \"email\": \"<string>\",\n \"id\": \"<integer>\",\n \"name\": \"<string>\"\n },\n \"brand_id\": \"<integer>\",\n \"cause\": \"<string>\",\n \"cause_id\": \"<integer>\",\n \"content\": \"<string>\",\n \"created_at\": \"<dateTime>\",\n \"id\": \"<integer>\",\n \"message_id\": \"<string>\",\n \"recipient\": \"<string>\",\n \"subject\": \"<string>\",\n \"ticket_id\": \"<integer>\",\n \"updated_at\": \"<dateTime>\",\n \"url\": \"<string>\",\n \"via\": {\n \"channel\": \"<string>\",\n \"source\": {\n \"from\": {\n \"address\": \"<string>\",\n \"id\": \"<integer>\",\n \"name\": \"<string>\",\n \"title\": \"<string>\"\n },\n \"rel\": \"<string>\",\n \"to\": {\n \"address\": \"<string>\",\n \"name\": \"<string>\"\n }\n }\n }\n }\n ]\n}"
}
]
}