Back to Collection Items
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess
$oReq = ObjCreate("Chilkat.HttpRequest")
$oReq.HttpVerb = "GET"
$oReq.Path = "/crm/v2/{{custom_module_api_name}}/{{record_id}}/photo"
$oReq.ContentType = "multipart/form-data"
$bSuccess = $oReq.AddFileForUpload2("file"," path to file","application/octet-stream")
$oReq.AddHeader "Authorization","Bearer <access_token>"
$oReq.AddHeader "Expect","100-continue"
Local $oResp = $oHttp.SynchronousRequest("domain.com",443,True,$oReq)
If ($oHttp.LastMethodSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
--form 'file=@"/path/to/file"'
https://domain.com/crm/v2/{{custom_module_api_name}}/{{record_id}}/photo
Postman Collection Item JSON
{
"name": "Custom",
"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/{{custom_module_api_name}}/{{record_id}}/photo",
"host": [
"{{api-domain}}"
],
"path": [
"crm",
"v2",
"{{custom_module_api_name}}",
"{{record_id}}",
"photo"
]
},
"description": "To download a photo associated with a module."
},
"response": [
]
}