PowerBuilder / Support API / Search Custom Object Records
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Name
string ls_Created_at
string ls_Created_by_user_id
string ls_Voluptate571
string ls_Aute_e
string ls_Nostrud_6f
string ls_Custom_object_key
string ls_External_id
string ls_Id
string ls_Updated_at
string ls_Updated_by_user_id
string ls_Url
string ls_Eu4
string ls_Count
string ls_Next_page
string ls_Previous_page
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Http.BasicAuth = 1
loo_Http.Login = "login"
loo_Http.Password = "password"
loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")
loo_QueryParams.UpdateString("name","<string>")
loo_Http.SetRequestHeader("Accept","application/json")
loo_Resp = loo_Http.QuickRequestParams("GET","https://example.zendesk.com/api/v2/custom_objects/:custom_object_key/records/autocomplete",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_QueryParams
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// 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
ls_Count = loo_JResp.StringOf("count")
ls_Next_page = loo_JResp.StringOf("next_page")
ls_Previous_page = loo_JResp.StringOf("previous_page")
i = 0
li_Count_i = loo_JResp.SizeOfArray("custom_object_records")
do while i < li_Count_i
loo_JResp.I = i
ls_Name = loo_JResp.StringOf("custom_object_records[i].name")
ls_Created_at = loo_JResp.StringOf("custom_object_records[i].created_at")
ls_Created_by_user_id = loo_JResp.StringOf("custom_object_records[i].created_by_user_id")
ls_Voluptate571 = loo_JResp.StringOf("custom_object_records[i].custom_object_fields.voluptate571")
ls_Aute_e = loo_JResp.StringOf("custom_object_records[i].custom_object_fields.aute_e")
ls_Nostrud_6f = loo_JResp.StringOf("custom_object_records[i].custom_object_fields.nostrud_6f")
ls_Custom_object_key = loo_JResp.StringOf("custom_object_records[i].custom_object_key")
ls_External_id = loo_JResp.StringOf("custom_object_records[i].external_id")
ls_Id = loo_JResp.StringOf("custom_object_records[i].id")
ls_Updated_at = loo_JResp.StringOf("custom_object_records[i].updated_at")
ls_Updated_by_user_id = loo_JResp.StringOf("custom_object_records[i].updated_by_user_id")
ls_Url = loo_JResp.StringOf("custom_object_records[i].url")
ls_Eu4 = loo_JResp.StringOf("custom_object_records[i].custom_object_fields.eu4")
i = i + 1
loop
destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp
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}"
}
]
}