Fetching Contact image from SugarCRM

Go To StackoverFlow.com


I'm trying to integrate my rails app with SugarCRM. Is it possible to fetch the Contact picture from SugarCRM using REST API? Please let me know.

2012-04-04 07:11
by Aravind


To get the profile image for a user do the following:

  1. Call the login method through REST
  2. Call the get_entry_list method through REST, with the following parameters:
    1. Module: Users
    2. Query: users.user_name = 'xxxx'
    3. Select_fields: picture
  3. The response contains the filename for the profile image, which is stored in /uploads.
  4. However, it is not possible to view the image in that folder due to .htaccess restrictions for security reasons, but other options exist:
    1. Extend the REST API with a method to serve profile images (similar to get_document_revision)
    2. Login on the server from your rails app and get the image
    3. Create a simple entrypoint+module in SugarCRM, which can show the picture
    4. Remove the .htaccess restiction for images (if it doesn't create a security risk in your setup)
2012-04-05 09:21
by Kåre Werner Storgaard
Thanks for the pointer Kåre. Let me try this. - Aravind 2012-04-05 14:46


In such scenario, I faced a problem where the upload folder stores file with name of the record id, i.e the GUID without file extension. So to cop up with this I did write a function to copy the file at same hierarchy but with its extension. Example: A png extension file at upload folder with name say, '32sdft-tg35f-Tuhis-675rtyf-77666-46dgc' will end up as, '32sdft-tg35f-Tuhis-675rtyf-77666-46dgc.png' Now only the path will be require to render the image.

Rest all things as applicable as suggested by our friend, Kare !!

2016-08-27 06:24
by mangesh mangesh