Xojo / Support API / Search Custom Object Records
Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Dim http As New Chilkat.Http
Dim success As Boolean
http.BasicAuth = True
http.Login = "login"
http.Password = "password"
Dim queryParams As New Chilkat.JsonObject
success = queryParams.UpdateString("name","<string>")
http.SetRequestHeader "Accept","application/json"
Dim resp As Chilkat.HttpResponse
resp = http.QuickRequestParams("GET","https://example.zendesk.com/api/v2/custom_objects/:custom_object_key/records/autocomplete",queryParams)
If (http.LastMethodSuccess = False) Then
System.DebugLog(http.LastErrorText)
Return
End If
Dim sbResponseBody As New Chilkat.StringBuilder
success = resp.GetBodySb(sbResponseBody)
Dim jResp As New Chilkat.JsonObject
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = False
System.DebugLog("Response Body:")
System.DebugLog(jResp.Emit())
Dim respStatusCode As Int32
respStatusCode = resp.StatusCode
System.DebugLog("Response Status Code = " + Str(respStatusCode))
If (respStatusCode >= 400) Then
System.DebugLog("Response Header:")
System.DebugLog(resp.Header)
System.DebugLog("Failed.")
Return
End If
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "count": "<integer>",
// "custom_object_records": [
// {
// "name": "<string>",
// "created_at": "<dateTime>",
// "created_by_user_id": "<string>",
// "custom_object_fields": {
// "voluptate571": "<string>",
// "aute_e": "<string>",
// "nostrud_6f": "<string>"
// },
// "custom_object_key": "<string>",
// "external_id": "<string>",
// "id": "<string>",
// "updated_at": "<dateTime>",
// "updated_by_user_id": "<string>",
// "url": "<string>"
// },
// {
// "name": "<string>",
// "created_at": "<dateTime>",
// "created_by_user_id": "<string>",
// "custom_object_fields": {
// "eu4": "<string>"
// },
// "custom_object_key": "<string>",
// "external_id": "<string>",
// "id": "<string>",
// "updated_at": "<dateTime>",
// "updated_by_user_id": "<string>",
// "url": "<string>"
// }
// ],
// "next_page": "<string>",
// "previous_page": "<string>"
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
Dim name As String
Dim created_at As String
Dim created_by_user_id As String
Dim Voluptate571 As String
Dim Aute_e As String
Dim Nostrud_6f As String
Dim custom_object_key As String
Dim external_id As String
Dim id As String
Dim updated_at As String
Dim updated_by_user_id As String
Dim url As String
Dim Eu4 As String
Dim count As String
count = jResp.StringOf("count")
Dim next_page As String
next_page = jResp.StringOf("next_page")
Dim previous_page As String
previous_page = jResp.StringOf("previous_page")
Dim i As Int32
i = 0
Dim count_i As Int32
count_i = jResp.SizeOfArray("custom_object_records")
While i < count_i
jResp.I = i
name = jResp.StringOf("custom_object_records[i].name")
created_at = jResp.StringOf("custom_object_records[i].created_at")
created_by_user_id = jResp.StringOf("custom_object_records[i].created_by_user_id")
Voluptate571 = jResp.StringOf("custom_object_records[i].custom_object_fields.voluptate571")
Aute_e = jResp.StringOf("custom_object_records[i].custom_object_fields.aute_e")
Nostrud_6f = jResp.StringOf("custom_object_records[i].custom_object_fields.nostrud_6f")
custom_object_key = jResp.StringOf("custom_object_records[i].custom_object_key")
external_id = jResp.StringOf("custom_object_records[i].external_id")
id = jResp.StringOf("custom_object_records[i].id")
updated_at = jResp.StringOf("custom_object_records[i].updated_at")
updated_by_user_id = jResp.StringOf("custom_object_records[i].updated_by_user_id")
url = jResp.StringOf("custom_object_records[i].url")
Eu4 = jResp.StringOf("custom_object_records[i].custom_object_fields.eu4")
i = i + 1
Wend
Curl Command
curl -u login:password -G -d "name=%3Cstring%3E"
-H "Accept: application/json"
https://example.zendesk.com/api/v2/custom_objects/:custom_object_key/records/autocomplete
Postman Collection Item JSON
{
"name": "Search Custom Object Records",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/custom_objects/:custom_object_key/records/autocomplete?name=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_objects",
":custom_object_key",
"records",
"autocomplete"
],
"query": [
{
"key": "name",
"value": "<string>",
"description": "Part of a name of the record you are searching for"
}
],
"variable": [
{
"key": "custom_object_key",
"value": "<string>"
}
]
},
"description": "Search for a record by its name\n#### Allowed For\n* Everyone"
},
"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/custom_objects/:custom_object_key/records/autocomplete?name=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_objects",
":custom_object_key",
"records",
"autocomplete"
],
"query": [
{
"key": "name",
"value": "<string>",
"description": "Part of a name of the record you are searching for"
}
],
"variable": [
{
"key": "custom_object_key"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"count\": \"<integer>\",\n \"custom_object_records\": [\n {\n \"name\": \"<string>\",\n \"created_at\": \"<dateTime>\",\n \"created_by_user_id\": \"<string>\",\n \"custom_object_fields\": {\n \"voluptate571\": \"<string>\",\n \"aute_e\": \"<string>\",\n \"nostrud_6f\": \"<string>\"\n },\n \"custom_object_key\": \"<string>\",\n \"external_id\": \"<string>\",\n \"id\": \"<string>\",\n \"updated_at\": \"<dateTime>\",\n \"updated_by_user_id\": \"<string>\",\n \"url\": \"<string>\"\n },\n {\n \"name\": \"<string>\",\n \"created_at\": \"<dateTime>\",\n \"created_by_user_id\": \"<string>\",\n \"custom_object_fields\": {\n \"eu4\": \"<string>\"\n },\n \"custom_object_key\": \"<string>\",\n \"external_id\": \"<string>\",\n \"id\": \"<string>\",\n \"updated_at\": \"<dateTime>\",\n \"updated_by_user_id\": \"<string>\",\n \"url\": \"<string>\"\n }\n ],\n \"next_page\": \"<string>\",\n \"previous_page\": \"<string>\"\n}"
}
]
}