Hello,
my name is Pietro and I am pretty new at developing with SuiteCRM. In what follows, I will try to explain my objective as clear as I can.
I’ve created a module - let us call it ‘ShowcaseFileRepo’ - based on the ‘File’ module template. Its purpose is to store the files I need for another ‘base’ module - let us call it ‘Showcase’ indeed - in a clean and neat way (other than use the built-in Documents module).
I am using the API v8 in a Python program to read/write the informations in the standard Showcase module and to upload files to the ShowcaseFileRepo one.
In order to upload a file to my custom ShowcaseFileRepo module, I’ve slightly modified the implementation of the
addFileToNote()
function for my case (in \Api\V8\Service\ModuleService.php ): if the module called is ‘ShowcaseFileRepo’, the function addFileToShowcaseRepo() will be called in a pretty analogous way to the case when ‘Note’ module will call the function above. This works fine.
However now I also need to download these files by using the API.
Unfortunately no corresponding methods already exists for the Document module - that is, a function which returns the file content of the document via the API v8 - at least, to my knowledge.
The fist question:
- does it exist a method for retrieving file contents via the API v8?
If not, how can I implement a function which
- in the case where the module contains the ‘filecontents’ field among the ‘attributes’, it performs a base_64 encoding of the file binaries to the filecontents attribute?
(something like {‘filecontents’ : ‘wejfojn03…’})
I do not want to save the filecontents base_64 when I upload the file, I would like the process of base_64 encoding to run only when the resource is requested.
Would you please attach some documentation for this? Thank you in advance,
Pietro