Hi all,
I have to extend saveFilePost in clients/base/api/FileApi.php, looking at https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.7/Integration/Web_Services/v10/Extend… seems so simple. In my case I have put in custom/clients/base/api/CustomFileApi.php this code:
<?php
require_once('clients/base/api/FileApi.php');
class CustomFileApi extends FileApi {
public function registerApiRest() {
return parent::registerApiRest();
}
public function saveFilePost($api, $args, $temporary = false) {
$field = $args['field'];
$bean = $this->loadBean($api, $args);
$def = $bean->field_defs[$field];
if($def['type'] == 'MyNewFileType') {
$def['type'] = 'image';
}
$response = parent::saveFilePost($api, $args, $temporary);
return $response;
}
}
Looking at {my_sugar}/rest/v10/help I've seen there are two identical endpoints, the only difference is the score, one is 9.50 (original) and one is 10.00 (custom).
I was thinking that this number is the priority but placing some breakpoints the call only stop in the original method.
Can someone help me? Thanks in advance.