PowerBuilder / Zoho CRM REST APIs / Get Bulk Read Job Details
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Id
string ls_Operation
string ls_State
integer li_Page
integer li_Per_page
integer li_Count
string ls_Download_url
integer li_More_records
string ls_Id
string ls_Api_name
string ls_Group_operator
integer li_QueryPage
string ls_Cvid
string ls_Created_byId
string ls_Name
string ls_Created_time
string ls_File_type
integer j
integer li_Count_j
string ls_StrVal
string ls_FieldId
string ls_FieldApi_name
string ls_Comparator
integer li_Value
string ls_Group_operator
integer k
integer li_Count_k
string ls_Value_str
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
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// Adds the "Authorization: Bearer {{access-token}}" header.
loo_Http.AuthToken = "{{access-token}}"
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Http.QuickGetSb("https://www.zohoapis.com/crm/bulk/v2.1/read/{{job_id}}",loo_SbResponseBody)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_SbResponseBody
return
end if
loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Http.LastHeader
Write-Debug "Failed."
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "data": [
// {
// "id": "4150868000005277059",
// "operation": "read",
// "state": "COMPLETED",
// "result": {
// "page": 1,
// "per_page": 200000,
// "count": 0,
// "download_url": "/crm/bulk/v2.1/read/4150868000005277059/result",
// "more_records": false
// },
// "query": {
// "fields": [
// "Last_Name",
// "Owner",
// "Owner.last_name",
// "$converted",
// "Lead_Source",
// "Lead_Status",
// "Company",
// "Email",
// "Mobile",
// "Created_Time"
// ],
// "module": {
// "id": "4150868000000002175",
// "api_name": "Leads"
// },
// "criteria": {
// "group": [
// {
// "field": {
// "id": null,
// "api_name": "$converted"
// },
// "comparator": "equal",
// "value": false
// },
// {
// "group": [
// {
// "field": {
// "id": "4150868000000002595",
// "api_name": "Last_Name"
// },
// "comparator": "equal",
// "value": "Patricia"
// },
// {
// "field": {
// "id": "4150868000000002599",
// "api_name": "Email"
// },
// "comparator": "equal",
// "value": "patricia.b@zylker.com"
// }
// ],
// "group_operator": "and"
// }
// ],
// "group_operator": "and"
// },
// "page": 1,
// "cvid": "4150868000000087501"
// },
// "created_by": {
// "id": "4150868000000225013",
// "name": "Patricia Boyle"
// },
// "created_time": "2021-05-03T18:32:25+05:30",
// "file_type": "csv"
// }
// ]
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
i = 0
li_Count_i = loo_JResp.SizeOfArray("data")
do while i < li_Count_i
loo_JResp.I = i
ls_Id = loo_JResp.StringOf("data[i].id")
ls_Operation = loo_JResp.StringOf("data[i].operation")
ls_State = loo_JResp.StringOf("data[i].state")
li_Page = loo_JResp.IntOf("data[i].result.page")
li_Per_page = loo_JResp.IntOf("data[i].result.per_page")
li_Count = loo_JResp.IntOf("data[i].result.count")
ls_Download_url = loo_JResp.StringOf("data[i].result.download_url")
li_More_records = loo_JResp.BoolOf("data[i].result.more_records")
ls_Id = loo_JResp.StringOf("data[i].query.module.id")
ls_Api_name = loo_JResp.StringOf("data[i].query.module.api_name")
ls_Group_operator = loo_JResp.StringOf("data[i].query.criteria.group_operator")
li_QueryPage = loo_JResp.IntOf("data[i].query.page")
ls_Cvid = loo_JResp.StringOf("data[i].query.cvid")
ls_Created_byId = loo_JResp.StringOf("data[i].created_by.id")
ls_Name = loo_JResp.StringOf("data[i].created_by.name")
ls_Created_time = loo_JResp.StringOf("data[i].created_time")
ls_File_type = loo_JResp.StringOf("data[i].file_type")
j = 0
li_Count_j = loo_JResp.SizeOfArray("data[i].query.fields")
do while j < li_Count_j
loo_JResp.J = j
ls_StrVal = loo_JResp.StringOf("data[i].query.fields[j]")
j = j + 1
loop
j = 0
li_Count_j = loo_JResp.SizeOfArray("data[i].query.criteria.group")
do while j < li_Count_j
loo_JResp.J = j
ls_FieldId = loo_JResp.StringOf("data[i].query.criteria.group[j].field.id")
ls_FieldApi_name = loo_JResp.StringOf("data[i].query.criteria.group[j].field.api_name")
ls_Comparator = loo_JResp.StringOf("data[i].query.criteria.group[j].comparator")
li_Value = loo_JResp.BoolOf("data[i].query.criteria.group[j].value")
ls_Group_operator = loo_JResp.StringOf("data[i].query.criteria.group[j].group_operator")
k = 0
li_Count_k = loo_JResp.SizeOfArray("data[i].query.criteria.group[j].group")
do while k < li_Count_k
loo_JResp.K = k
ls_FieldId = loo_JResp.StringOf("data[i].query.criteria.group[j].group[k].field.id")
ls_FieldApi_name = loo_JResp.StringOf("data[i].query.criteria.group[j].group[k].field.api_name")
ls_Comparator = loo_JResp.StringOf("data[i].query.criteria.group[j].group[k].comparator")
ls_Value_str = loo_JResp.StringOf("data[i].query.criteria.group[j].group[k].value")
k = k + 1
loop
j = j + 1
loop
i = i + 1
loop
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
-H "Authorization: Bearer {{access-token}}"
https://www.zohoapis.com/crm/bulk/v2.1/read/{{job_id}}
Postman Collection Item JSON
{
"name": "Get Bulk Read Job Details",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access-token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{access-token}}",
"type": "text"
}
],
"url": {
"raw": "https://www.zohoapis.com/crm/bulk/v2.1/read/{{job_id}}",
"protocol": "https",
"host": [
"www",
"zohoapis",
"com"
],
"path": [
"crm",
"bulk",
"v2.1",
"read",
"{{job_id}}"
]
},
"description": "To get the details of a bulk read job performed previously.\n\n"
},
"response": [
{
"name": "SUCCESS RESPONSE",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{access-token}}",
"type": "text"
}
],
"url": {
"raw": "https://www.zohoapis.com/crm/bulk/v2.1/read/4150868000005277059",
"protocol": "https",
"host": [
"www",
"zohoapis",
"com"
],
"path": [
"crm",
"bulk",
"v2.1",
"read",
"4150868000005277059"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 04 May 2021 11:25:24 GMT"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-cache"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-05-04T17:55:19+05:30"
},
{
"key": "vary",
"value": "accept-encoding"
},
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Strict-Transport-Security",
"value": "max-age=63072000"
}
],
"cookie": [
],
"body": "{\n \"data\": [\n {\n \"id\": \"4150868000005277059\",\n \"operation\": \"read\",\n \"state\": \"COMPLETED\",\n \"result\": {\n \"page\": 1,\n \"per_page\": 200000,\n \"count\": 0,\n \"download_url\": \"/crm/bulk/v2.1/read/4150868000005277059/result\",\n \"more_records\": false\n },\n \"query\": {\n \"fields\": [\n \"Last_Name\",\n \"Owner\",\n \"Owner.last_name\",\n \"$converted\",\n \"Lead_Source\",\n \"Lead_Status\",\n \"Company\",\n \"Email\",\n \"Mobile\",\n \"Created_Time\"\n ],\n \"module\": {\n \"id\": \"4150868000000002175\",\n \"api_name\": \"Leads\"\n },\n \"criteria\": {\n \"group\": [\n {\n \"field\": {\n \"id\": null,\n \"api_name\": \"$converted\"\n },\n \"comparator\": \"equal\",\n \"value\": false\n },\n {\n \"group\": [\n {\n \"field\": {\n \"id\": \"4150868000000002595\",\n \"api_name\": \"Last_Name\"\n },\n \"comparator\": \"equal\",\n \"value\": \"Patricia\"\n },\n {\n \"field\": {\n \"id\": \"4150868000000002599\",\n \"api_name\": \"Email\"\n },\n \"comparator\": \"equal\",\n \"value\": \"patricia.b@zylker.com\"\n }\n ],\n \"group_operator\": \"and\"\n }\n ],\n \"group_operator\": \"and\"\n },\n \"page\": 1,\n \"cvid\": \"4150868000000087501\"\n },\n \"created_by\": {\n \"id\": \"4150868000000225013\",\n \"name\": \"Patricia Boyle\"\n },\n \"created_time\": \"2021-05-03T18:32:25+05:30\",\n \"file_type\": \"csv\"\n }\n ]\n}"
},
{
"name": "INVALID_URL_PATTERN",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{access-token}}",
"type": "text"
}
],
"url": {
"raw": "https://www.zohoapis.com/crm/bulk/v2.1/read4150868000005277059",
"protocol": "https",
"host": [
"www",
"zohoapis",
"com"
],
"path": [
"crm",
"bulk",
"v2.1",
"read4150868000005277059"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 04 May 2021 11:26:53 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "131"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "X-Frame-Options",
"value": "deny"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
}
],
"cookie": [
],
"body": "{\n \"code\": \"INVALID_URL_PATTERN\",\n \"details\": {},\n \"message\": \"Please check if the URL trying to access is a correct one\",\n \"status\": \"error\"\n}"
},
{
"name": "INVALID_REQUEST_METHOD",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{access-token}}",
"type": "text"
}
],
"url": {
"raw": "https://www.zohoapis.com/crm/bulk/v2.1/read/4150868000005277059",
"protocol": "https",
"host": [
"www",
"zohoapis",
"com"
],
"path": [
"crm",
"bulk",
"v2.1",
"read",
"4150868000005277059"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 04 May 2021 11:27:28 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "124"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "X-Frame-Options",
"value": "deny"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
}
],
"cookie": [
],
"body": "{\n \"code\": \"INVALID_REQUEST_METHOD\",\n \"details\": {},\n \"message\": \"The http request method type is not a valid one\",\n \"status\": \"error\"\n}"
},
{
"name": "RESOURCE_NOT_FOUND",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{access-token}}",
"type": "text"
}
],
"url": {
"raw": "https://www.zohoapis.com/crm/bulk/v2.1/read/415086800000527705",
"protocol": "https",
"host": [
"www",
"zohoapis",
"com"
],
"path": [
"crm",
"bulk",
"v2.1",
"read",
"415086800000527705"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 04 May 2021 11:27:58 GMT"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Transfer-Encoding",
"value": "chunked"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-cache"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-05-04T17:55:19+05:30"
},
{
"key": "vary",
"value": "accept-encoding"
},
{
"key": "Content-Encoding",
"value": "gzip"
}
],
"cookie": [
],
"body": "{\n \"status\": \"error\",\n \"code\": \"RESOURCE_NOT_FOUND\",\n \"message\": \"The requested resource doesn't exist.\",\n \"details\": {\n \"resource\": \"415086800000527705\"\n }\n}"
},
{
"name": "OAUTH_SCOPE_MISMATCH",
"originalRequest": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{access-token}}",
"type": "text"
}
],
"url": {
"raw": "{{api-domain}}/crm/bulk/v2.1/read/4150868000005277059",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"bulk",
"v2.1",
"read",
"4150868000005277059"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 04 May 2021 13:36:09 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "113"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "Referrer-Policy",
"value": "strict-origin"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
},
{
"key": "Pragma",
"value": "no-cache"
},
{
"key": "Cache-Control",
"value": "no-cache"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-Download-Options",
"value": "noopen"
}
],
"cookie": [
],
"body": "{\n \"code\": \"OAUTH_SCOPE_MISMATCH\",\n \"details\": {},\n \"message\": \"invalid oauth scope to access this URL\",\n \"status\": \"error\"\n}"
}
]
}