Exporting File via RESTful API

SOLVED

Hi All, 

Does anyone know if you can grab a file from the library using the RESTful API? Have a customer's IT asking as they want to get certain files out as they're writing something that accesses CRM over the API. 

  • +1
    verified answer

    Hi Matthew

    NOT via the REST API but the path to file looks like this

    http://localhost/crm/eware.dll/do/Gatecom+Inc/Panoply+Customer+Letter190570093.pdf?SID=108347163661659&Act=1282&Mode=0&FileName=Gatecom+Inc\Panoply+Customer+Letter190570093.pdf

    The library/documents entity can be accessed via the REST API.  That would give you much of the information you need to assemble the path.

  • 0 in reply to Sage CRM

    Trying to do this on an external URL with something similar to below, but it fails to work. I'm guessing I need some kind of SID. 

    crm.CustomerDomain.ie/crm/eware.dll/do/AN+Other/Example.jpg?FileName=AN+Other\Example.jpg

    Is there somewhere I could direct their IT guys to go to for more information. I have pointed them to the help.sagecrm.com area but doesn't seem to be anything in the guides there about downloading files out of CRM, just how to create the Library entry when uploading.

  • 0 in reply to Matthew Shaw

    Have a look at this article:  (+) Sage CRM 2022 R1: REST improvements (Quickfind) - Sage CRM Hints, Tips and Tricks - Sage CRM - Sage City Community

    That explains how the some of the REST calls need a SID.  The Postman collection for Sage CRM available via developer.sage.com explain how a SOAP call needs to be used first to get a SID.

    Once you have the SID you can build the link to fetch the file. 

  • 0 in reply to Sage CRM

    Is there somewhere else I need to post on this subject to get help. The customer's developers have some back with the following

    "...We can't receive the image through the feed currently because we have no path URL from the API to link the image to the feed. We were trying to fix this manually by combining the folder plus file name using a SID number, but this throws a 404 error. 

     We need help, with an example if possible, to set this up correctly via the API feed..."

  • +1 in reply to Matthew Shaw
    verified answer

    Hi Matthew

    The API is not designed to serve an image or file.  BUT this idea of building a path to a file does work

    http://localhost/crm/eware.dll/do/Gatecom+Inc/Panoply+Sales+Quote601158125.pdf?SID=166740267048548&Act=1282&Mode=0&FileName=Gatecom+Inc\Panoply+Sales+Quote601158125.pdf

    http(s)://[servername]/[installname]/eware.dll/do/[folder name]/[filename]?SID=[ValidSIDvalue]&Act=1282&Mode=0&FileName=[folder name]\[filename]

    The full path is needed and if it is built correctly then the next error I would expect is  

    "Authentication required, Browser session mismatch. "

    1. Open Sage CRM  > Administration > System > System Behaviour 
    2. Ensure "use browser session security" is disabled
  • 0 in reply to Sage CRM

    Customer now has this working. Thanks everyone who replied.