Chilkat Online Tools

Foxpro / Zoho CRM REST APIs / Accounts

Back to Collection Items

LOCAL loHttp
LOCAL lnSuccess
LOCAL loReq
LOCAL loResp

* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')

* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.HttpRequest')
loReq = CreateObject('Chilkat.HttpRequest')
loReq.HttpVerb = "GET"
loReq.Path = "/crm/v2/Accounts/{{record_id}}/photo"
loReq.ContentType = "multipart/form-data"
lnSuccess = loReq.AddFileForUpload2("file"," path to file","application/octet-stream")

loReq.AddHeader("Authorization","Bearer <access_token>")
loReq.AddHeader("Expect","100-continue")

loResp = loHttp.SynchronousRequest("domain.com",443,1,loReq)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loReq
    CANCEL
ENDIF

? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp

RELEASE loHttp
RELEASE loReq

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
	--form 'file=@"/path/to/file"'
https://domain.com/crm/v2/Accounts/{{record_id}}/photo

Postman Collection Item JSON

{
  "name": "Accounts",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{access-token}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "file",
          "type": "file",
          "src": "/Users/sneha-9300/Desktop/image.jpg"
        }
      ]
    },
    "url": {
      "raw": "{{api-domain}}/crm/v2/Accounts/{{record_id}}/photo",
      "host": [
        "{{api-domain}}"
      ],
      "path": [
        "crm",
        "v2",
        "Accounts",
        "{{record_id}}",
        "photo"
      ]
    },
    "description": "To download a photo associated with a module."
  },
  "response": [
  ]
}