How can upload image using rest API v4_1 for account module

How can upload the image for account module using rest API v4_1.

Here is a link to set_entry method for creating and updating records

Specifically for image or file data
in the rest_data name_value_list you need two entries for file or image

  1. field_name => file_name with extension
  2. field_name_file => base 64 encoded file content
{
  "session": "ucgegpjlpl6gvtvedhcmhrc9ba",
  "module_name": "Accounts",
  "name_value_list": [
    {
      "id": "CRM_RECORD_ID",
      "passport_copy_c": "FILENAME_WITH_EXTENSION",
      "passport_copy_c_file": "BASE64_ENCODED_FILE_CONTENT"
    }
  ]
}

Thanks @abuzarfaris,

We have followed instruction as you suggest but it’s not working please suggest if doing wrong


Are you using soap or rest api ?

No, I am using Rest API

Shouldn’t your name value list be something like

$name_value_list=array(
"id"=>$id,
"job_description_attachment_c"=>$fileName,
"job_description_attachment_c_file"=>$contents
);

using the right array parameters, see the response of parameter array. we updated multiple record with same way but have a issue with image only