Reputation: 610
I'm using SugarCRM Enterprise, Version 8.1.0 (Build 135) (Summer '18), the cloud version and I need, from an external site, to get the list of all EmailTemplates and for earch EmailTemplate the list of its attachments (or Notes), via the API.
I can list all EmailTemplates but can't find, for each of them, the list of attached files, what do I have to do (with the API)?
Upvotes: 1
Views: 396
Reputation: 3950
One way to do this is to use the Filter API on the Notes module to get the attachments for each EmailTemplate. This is the only way I found so far, as using the "attachments" link in EmailTemplates did not yield any results...
Example: POST
request to /rest/v11_2/Notes/filter
with following payload:
{
max_num: 1000,
fields: ["id", "name"], /* specify the fields you want to receive */
filter: [
{"email_id": "<id of the email template goes here>"},
],
}
For more info regarding the filter API see "POST /<module>/filter
" at <sugar_site>/rest/v11_2/help
Notes:
{filter: [{parent_type:"Emails", parent_id: "<id of the email template goes here>"}]}
Upvotes: 1