Search and return JSON for open tickets.
curl -X GET https://subdomain.zendesk.com/api/v2/search.json \
-H "Accept: application/json" \
--data-urlencode "query=type:ticket status:open" \
-u zendesk_email:zendesk_password
Dim rest As New Chilkat.Rest
Dim success As Boolean
' URL: https://subdomain.zendesk.com/api/v2/search.json
Dim bTls As Boolean = True
Dim port As Integer = 443
Dim bAutoReconnect As Boolean = True
success = Await rest.ConnectAsync("subdomain.zendesk.com",port,bTls,bAutoReconnect)
If (success <> True) Then
Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
Debug.WriteLine(rest.LastErrorText)
Exit Sub
End If
rest.SetAuthBasic("zendesk_email","zendesk_password")
rest.AddQueryParam("query","type:ticket status:open")
rest.AddHeader("Accept","application/json")
Dim strResponseBody As String = Await rest.FullRequestFormUrlEncodedAsync("GET","/api/v2/search.json")
If (rest.LastMethodSuccess <> True) Then
Debug.WriteLine(rest.LastErrorText)
Exit Sub
End If
Dim respStatusCode As Integer = rest.ResponseStatusCode
If (respStatusCode >= 400) Then
Debug.WriteLine("Response Status Code = " & respStatusCode)
Debug.WriteLine("Response Header:")
Debug.WriteLine(rest.ResponseHeader)
Debug.WriteLine("Response Body:")
Debug.WriteLine(strResponseBody)
Exit Sub
End If
Dim jsonResponse As New Chilkat.JsonObject
jsonResponse.Load(strResponseBody)
Dim facets As String
Dim next_page As String
Dim previous_page As String
Dim count As Integer
Dim i As Integer
Dim count_i As Integer
Dim url As String
Dim id As Integer
Dim external_id As String
Dim viaChannel As String
Dim viaSourceRel As String
Dim created_at As String
Dim updated_at As String
Dim type As String
Dim subject As String
Dim raw_subject As String
Dim description As String
Dim priority As String
Dim status As String
Dim recipient As String
Dim requester_id As Integer
Dim submitter_id As Integer
Dim assignee_id As Integer
Dim organization_id As Integer
Dim group_id As Integer
Dim forum_topic_id As String
Dim problem_id As String
Dim has_incidents As Boolean
Dim is_public As Boolean
Dim due_at As String
Dim satisfaction_rating As String
Dim brand_id As Integer
Dim allow_channelback As Boolean
Dim result_type As String
Dim j As Integer
Dim count_j As Integer
Dim strVal As String
facets = jsonResponse.StringOf("facets")
next_page = jsonResponse.StringOf("next_page")
previous_page = jsonResponse.StringOf("previous_page")
count = jsonResponse.IntOf("count")
i = 0
count_i = jsonResponse.SizeOfArray("results")
While i < count_i
jsonResponse.I = i
url = jsonResponse.StringOf("results[i].url")
id = jsonResponse.IntOf("results[i].id")
external_id = jsonResponse.StringOf("results[i].external_id")
viaChannel = jsonResponse.StringOf("results[i].via.channel")
viaSourceRel = jsonResponse.StringOf("results[i].via.source.rel")
created_at = jsonResponse.StringOf("results[i].created_at")
updated_at = jsonResponse.StringOf("results[i].updated_at")
type = jsonResponse.StringOf("results[i].type")
subject = jsonResponse.StringOf("results[i].subject")
raw_subject = jsonResponse.StringOf("results[i].raw_subject")
description = jsonResponse.StringOf("results[i].description")
priority = jsonResponse.StringOf("results[i].priority")
status = jsonResponse.StringOf("results[i].status")
recipient = jsonResponse.StringOf("results[i].recipient")
requester_id = jsonResponse.IntOf("results[i].requester_id")
submitter_id = jsonResponse.IntOf("results[i].submitter_id")
assignee_id = jsonResponse.IntOf("results[i].assignee_id")
organization_id = jsonResponse.IntOf("results[i].organization_id")
group_id = jsonResponse.IntOf("results[i].group_id")
forum_topic_id = jsonResponse.StringOf("results[i].forum_topic_id")
problem_id = jsonResponse.StringOf("results[i].problem_id")
has_incidents = jsonResponse.BoolOf("results[i].has_incidents")
is_public = jsonResponse.BoolOf("results[i].is_public")
due_at = jsonResponse.StringOf("results[i].due_at")
satisfaction_rating = jsonResponse.StringOf("results[i].satisfaction_rating")
brand_id = jsonResponse.IntOf("results[i].brand_id")
allow_channelback = jsonResponse.BoolOf("results[i].allow_channelback")
result_type = jsonResponse.StringOf("results[i].result_type")
j = 0
count_j = jsonResponse.SizeOfArray("results[i].collaborator_ids")
While j < count_j
jsonResponse.J = j
j = j + 1
End While
j = 0
count_j = jsonResponse.SizeOfArray("results[i].follower_ids")
While j < count_j
jsonResponse.J = j
j = j + 1
End While
j = 0
count_j = jsonResponse.SizeOfArray("results[i].email_cc_ids")
While j < count_j
jsonResponse.J = j
j = j + 1
End While
j = 0
count_j = jsonResponse.SizeOfArray("results[i].tags")
While j < count_j
jsonResponse.J = j
strVal = jsonResponse.StringOf("results[i].tags[j]")
j = j + 1
End While
j = 0
count_j = jsonResponse.SizeOfArray("results[i].custom_fields")
While j < count_j
jsonResponse.J = j
j = j + 1
End While
j = 0
count_j = jsonResponse.SizeOfArray("results[i].sharing_agreement_ids")
While j < count_j
jsonResponse.J = j
j = j + 1
End While
j = 0
count_j = jsonResponse.SizeOfArray("results[i].fields")
While j < count_j
jsonResponse.J = j
j = j + 1
End While
j = 0
count_j = jsonResponse.SizeOfArray("results[i].followup_ids")
While j < count_j
jsonResponse.J = j
j = j + 1
End While
i = i + 1
End While
{
"results": [
{
"url": "https://chilkat.zendesk.com/api/v2/tickets/4.json",
"id": 4,
"external_id": null,
"via": {
"channel": "web",
"source": {
"from": {},
"to": {},
"rel": null
}
},
"created_at": "2018-04-14T21:06:06Z",
"updated_at": "2018-04-14T21:06:06Z",
"type": "incident",
"subject": "Fix bug in software",
"raw_subject": "Fix bug in software",
"description": "Fix a bug in the software...",
"priority": "urgent",
"status": "open",
"recipient": null,
"requester_id": 361801727573,
"submitter_id": 361801727573,
"assignee_id": 361801727573,
"organization_id": 360015071793,
"group_id": 360000681553,
"collaborator_ids": [
],
"follower_ids": [
],
"email_cc_ids": [
],
"forum_topic_id": null,
"problem_id": null,
"has_incidents": false,
"is_public": true,
"due_at": null,
"tags": [
"bug"
],
"custom_fields": [
],
"satisfaction_rating": null,
"sharing_agreement_ids": [
],
"fields": [
],
"followup_ids": [
],
"brand_id": 360000471533,
"allow_channelback": false,
"result_type": "ticket"
},
{
"url": "https://chilkat.zendesk.com/api/v2/tickets/3.json",
"id": 3,
"external_id": null,
"via": {
"channel": "web",
"source": {
"from": {},
"to": {},
"rel": null
}
},
"created_at": "2018-04-14T21:03:21Z",
"updated_at": "2018-04-14T21:03:21Z",
"type": "task",
"subject": "Add cool new feature.",
"raw_subject": "Add cool new feature.",
"description": "Add a cool new feature to the product.",
"priority": "high",
"status": "open",
"recipient": null,
"requester_id": 361801727573,
"submitter_id": 361801727573,
"assignee_id": 361801727573,
"organization_id": 360015071793,
"group_id": 360000681553,
"collaborator_ids": [
],
"follower_ids": [
],
"email_cc_ids": [
],
"forum_topic_id": null,
"problem_id": null,
"has_incidents": false,
"is_public": true,
"due_at": "2018-04-18T17:00:00Z",
"tags": [
"cool",
"feature"
],
"custom_fields": [
],
"satisfaction_rating": null,
"sharing_agreement_ids": [
],
"fields": [
],
"followup_ids": [
],
"brand_id": 360000471533,
"allow_channelback": false,
"result_type": "ticket"
},
{
"url": "https://chilkat.zendesk.com/api/v2/tickets/1.json",
"id": 1,
"external_id": null,
"via": {
"channel": "sample_ticket",
"source": {
"from": {},
"to": {},
"rel": null
}
},
"created_at": "2018-04-14T19:01:56Z",
"updated_at": "2018-04-14T19:01:57Z",
"type": "incident",
"subject": "Sample ticket: Meet the ticket",
"raw_subject": "Sample ticket: Meet the ticket",
"description": "Hi Matt,\n\nEmails, chats, voicemails, and tweets are captured in Zendesk Support as tickets. Start typing above to respond and click Submit to send. To test how an email becomes a ticket, send a message to support@chilkat.zendesk.com.\n\nCurious about what your customers will see when you reply? Check out this video:\nhttps://demos.zendesk.com/hc/en-us/articles/202341799\n",
"priority": "normal",
"status": "open",
"recipient": null,
"requester_id": 361809055094,
"submitter_id": 361801727573,
"assignee_id": 361801727573,
"organization_id": null,
"group_id": 360000681553,
"collaborator_ids": [
],
"follower_ids": [
],
"email_cc_ids": [
],
"forum_topic_id": null,
"problem_id": null,
"has_incidents": false,
"is_public": true,
"due_at": null,
"tags": [
"sample",
"support",
"zendesk"
],
"custom_fields": [
],
"satisfaction_rating": null,
"sharing_agreement_ids": [
],
"fields": [
],
"followup_ids": [
],
"brand_id": 360000471533,
"allow_channelback": false,
"result_type": "ticket"
}
],
"facets": null,
"next_page": null,
"previous_page": null,
"count": 3
}