Perl / Support API / List Suspended Tickets
Back to Collection Items
use chilkat();
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
$http = chilkat::CkHttp->new();
$http->put_BasicAuth(1);
$http->put_Login("login");
$http->put_Password("password");
$queryParams = chilkat::CkJsonObject->new();
$queryParams->UpdateString("sort_by","<string>");
$queryParams->UpdateString("sort_order","<string>");
$http->SetRequestHeader("Accept","application/json");
# resp is a HttpResponse
$resp = $http->QuickRequestParams("GET","https://example.zendesk.com/api/v2/suspended_tickets",$queryParams);
if ($http->get_LastMethodSuccess() == 0) {
print $http->lastErrorText() . "\r\n";
exit;
}
$sbResponseBody = chilkat::CkStringBuilder->new();
$resp->GetBodySb($sbResponseBody);
$jResp = chilkat::CkJsonObject->new();
$jResp->LoadSb($sbResponseBody);
$jResp->put_EmitCompact(0);
print "Response Body:" . "\r\n";
print $jResp->emit() . "\r\n";
$respStatusCode = $resp->get_StatusCode();
print "Response Status Code = " . $respStatusCode . "\r\n";
if ($respStatusCode >= 400) {
print "Response Header:" . "\r\n";
print $resp->header() . "\r\n";
print "Failed." . "\r\n";
exit;
}
# Sample JSON response:
# (Sample code for parsing the JSON response is shown below)
# {
# "suspended_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>"
# }
# }
# }
# },
# {
# "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
$i = 0;
$count_i = $jResp->SizeOfArray("suspended_tickets");
while ($i < $count_i) {
$jResp->put_I($i);
$v_Email = $jResp->stringOf("suspended_tickets[i].author.email");
$Id = $jResp->stringOf("suspended_tickets[i].author.id");
$Name = $jResp->stringOf("suspended_tickets[i].author.name");
$brand_id = $jResp->stringOf("suspended_tickets[i].brand_id");
$cause = $jResp->stringOf("suspended_tickets[i].cause");
$cause_id = $jResp->stringOf("suspended_tickets[i].cause_id");
$content = $jResp->stringOf("suspended_tickets[i].content");
$created_at = $jResp->stringOf("suspended_tickets[i].created_at");
$id = $jResp->stringOf("suspended_tickets[i].id");
$message_id = $jResp->stringOf("suspended_tickets[i].message_id");
$recipient = $jResp->stringOf("suspended_tickets[i].recipient");
$subject = $jResp->stringOf("suspended_tickets[i].subject");
$ticket_id = $jResp->stringOf("suspended_tickets[i].ticket_id");
$updated_at = $jResp->stringOf("suspended_tickets[i].updated_at");
$url = $jResp->stringOf("suspended_tickets[i].url");
$Channel = $jResp->stringOf("suspended_tickets[i].via.channel");
$Address = $jResp->stringOf("suspended_tickets[i].via.source.from.address");
$FromId = $jResp->stringOf("suspended_tickets[i].via.source.from.id");
$FromName = $jResp->stringOf("suspended_tickets[i].via.source.from.name");
$Title = $jResp->stringOf("suspended_tickets[i].via.source.from.title");
$Rel = $jResp->stringOf("suspended_tickets[i].via.source.rel");
$ToAddress = $jResp->stringOf("suspended_tickets[i].via.source.to.address");
$ToName = $jResp->stringOf("suspended_tickets[i].via.source.to.name");
$j = 0;
$count_j = $jResp->SizeOfArray("suspended_tickets[i].attachments");
while ($j < $count_j) {
$jResp->put_J($j);
$content_type = $jResp->stringOf("suspended_tickets[i].attachments[j].content_type");
$content_url = $jResp->stringOf("suspended_tickets[i].attachments[j].content_url");
$deleted = $jResp->stringOf("suspended_tickets[i].attachments[j].deleted");
$file_name = $jResp->stringOf("suspended_tickets[i].attachments[j].file_name");
$height = $jResp->stringOf("suspended_tickets[i].attachments[j].height");
$id = $jResp->stringOf("suspended_tickets[i].attachments[j].id");
$inline = $jResp->stringOf("suspended_tickets[i].attachments[j].inline");
$malware_access_override = $jResp->stringOf("suspended_tickets[i].attachments[j].malware_access_override");
$malware_scan_result = $jResp->stringOf("suspended_tickets[i].attachments[j].malware_scan_result");
$mapped_content_url = $jResp->stringOf("suspended_tickets[i].attachments[j].mapped_content_url");
$size = $jResp->stringOf("suspended_tickets[i].attachments[j].size");
$url = $jResp->stringOf("suspended_tickets[i].attachments[j].url");
$width = $jResp->stringOf("suspended_tickets[i].attachments[j].width");
$k = 0;
$count_k = $jResp->SizeOfArray("suspended_tickets[i].attachments[j].thumbnails");
while ($k < $count_k) {
$jResp->put_K($k);
$content_type = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].content_type");
$content_url = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].content_url");
$deleted = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].deleted");
$file_name = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].file_name");
$height = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].height");
$id = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].id");
$inline = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].inline");
$malware_access_override = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].malware_access_override");
$malware_scan_result = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].malware_scan_result");
$mapped_content_url = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].mapped_content_url");
$size = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].size");
$url = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].url");
$width = $jResp->stringOf("suspended_tickets[i].attachments[j].thumbnails[k].width");
$k = $k + 1;
}
$j = $j + 1;
}
$i = $i + 1;
}
Curl Command
curl -u login:password -G -d "sort_by=%3Cstring%3E"
-d "sort_order=%3Cstring%3E"
-H "Accept: application/json"
https://example.zendesk.com/api/v2/suspended_tickets
Postman Collection Item JSON
{
"name": "List Suspended Tickets",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/suspended_tickets?sort_by=<string>&sort_order=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"suspended_tickets"
],
"query": [
{
"key": "sort_by",
"value": "<string>",
"description": "The field to sort the ticket by, being one of `author_email`, `cause`, `created_at`, or `subject`."
},
{
"key": "sort_order",
"value": "<string>",
"description": "The order in which to sort the suspended tickets. This can take value `asc` or `desc`."
}
]
},
"description": "#### Allowed For\n\n* Unrestricted agents\n\n#### Sorting\n\nYou can sort the tickets with the `sort_by` and `sort_order` query string parameters.\n"
},
"response": [
{
"name": "Success response",
"originalRequest": {
"method": "GET",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/suspended_tickets?sort_by=<string>&sort_order=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"suspended_tickets"
],
"query": [
{
"key": "sort_by",
"value": "<string>",
"description": "The field to sort the ticket by, being one of `author_email`, `cause`, `created_at`, or `subject`."
},
{
"key": "sort_order",
"value": "<string>",
"description": "The order in which to sort the suspended tickets. This can take value `asc` or `desc`."
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"suspended_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 }\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}"
}
]
}