Back to Collection Items
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
var success: Bool
// Adds the "Authorization: Bearer <access_token>" header.
http.authToken = "<access_token>"
let sbResponseBody = CkoStringBuilder()!
success = http.quickGetSb("https://domain.com/crm/v2.1/Leads/{{record_id}}/photo", sbContent: sbResponseBody)
if success == false {
print("\(http.lastErrorText!)")
return
}
print("Response status code = \(http.lastStatus.intValue)")
print("\(sbResponseBody.getAsString()!)")
}
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://domain.com/crm/v2.1/Leads/{{record_id}}/photo
Postman Collection Item JSON
{
"name": "Leads",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{access-token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Leads/{{record_id}}/photo",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Leads",
"{{record_id}}",
"photo"
]
},
"description": "To download a photo associated with a module."
},
"response": [
{
"name": "INVALID_MODULE",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Lead/4150868000004943003/photo",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Lead",
"4150868000004943003",
"photo"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 12:06:10 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "133"
},
{
"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-03T18:26:34+05:30"
},
{
"key": "clientVersion",
"value": "4002155"
},
{
"key": "clientsubVersion",
"value": "bfb2326744b42e5c869a705645ac0006"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "Content-Language",
"value": "en-US"
}
],
"cookie": [
],
"body": "{\n \"code\": \"INVALID_MODULE\",\n \"details\": {\n \"resource_path_index\": 0\n },\n \"message\": \"the module name given seems to be invalid\",\n \"status\": \"error\"\n}"
},
{
"name": "INVALID_URL_PATTERN",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Lead/4150868000004943003photo",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Lead",
"4150868000004943003photo"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 12:06:31 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "131"
},
{
"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-03T18:26:34+05:30"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "Content-Language",
"value": "en-US"
}
],
"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": "PATCH",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Lead/4150868000004943003/photo",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Lead",
"4150868000004943003",
"photo"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 12:07:09 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": "AUTHENTICATION_FAILURE",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Lead/4150868000004943003/photo",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Lead",
"4150868000004943003",
"photo"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 12:07:33 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "98"
},
{
"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\": \"AUTHENTICATION_FAILURE\",\n \"details\": {},\n \"message\": \"Authentication failed\",\n \"status\": \"error\"\n}"
},
{
"name": "OAUTH_SCOPE_MISMATCH",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Lead/4150868000004943003/photo",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Lead",
"4150868000004943003",
"photo"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Mon, 03 May 2021 13:31:44 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}"
},
{
"name": "NOT_APPROVED",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Leads/{{record-id}}/photo",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Leads",
"{{record-id}}",
"photo"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 05 Oct 2021 18:03:21 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "145"
},
{
"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-store, no-cache, must-revalidate, private"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-10-06T00:19:01+05:30"
},
{
"key": "clientVersion",
"value": "4424120"
},
{
"key": "clientsubVersion",
"value": "b071b45b5286ac3f4f7a4c7bb9fcbc54"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "Content-Language",
"value": "en-US"
}
],
"cookie": [
],
"body": "{\n \"code\": \"NOT_APPROVED\",\n \"details\": {\n \"id\": \"1306462000000496025\"\n },\n \"message\": \"cannot get the record image that is not approved yet\",\n \"status\": \"error\"\n}"
},
{
"name": "RECORD_LOCKED",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{api-domain}}/crm/v2.1/Leads/{{record-id}}/photo",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2.1",
"Leads",
"{{record-id}}",
"photo"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Server",
"value": "ZGS"
},
{
"key": "Date",
"value": "Tue, 05 Oct 2021 18:10:49 GMT"
},
{
"key": "Content-Type",
"value": "application/json;charset=utf-8"
},
{
"key": "Content-Length",
"value": "178"
},
{
"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-store, no-cache, must-revalidate, private"
},
{
"key": "Expires",
"value": "Thu, 01 Jan 1970 00:00:00 GMT"
},
{
"key": "X-Frame-Options",
"value": "SAMEORIGIN"
},
{
"key": "X-ACCESSTOKEN-RESET",
"value": "2021-10-06T00:35:08+05:30"
},
{
"key": "clientVersion",
"value": "4424120"
},
{
"key": "clientsubVersion",
"value": "b071b45b5286ac3f4f7a4c7bb9fcbc54"
},
{
"key": "Content-Disposition",
"value": "attachment; filename=response.json"
},
{
"key": "X-Download-Options",
"value": "noopen"
},
{
"key": "Content-Language",
"value": "en-US"
}
],
"cookie": [
],
"body": "{\n \"code\": \"RECORD_LOCKED\",\n \"details\": {\n \"action\": \"zia_vision_processing\",\n \"id\": \"475243000003269880\"\n },\n \"message\": \"cannot get the record image that is not approved yet\",\n \"status\": \"error\"\n}"
}
]
}