Hi! I'm new to Sugar and I don't know hot to call a custom rest api from a hook in a custom module.
I added the custom rest endpoint to custom module in sugar, I created the after_save hook class and method, but now I'm stacked to how to call the api from the hook.
My code for the API is:
<?php
class GetOdinNameApi extends SugarApi {
public function registerApiRest() {
return array(
'getOdinName' => array(
'reqType' => 'GET',
'path' => array('<custom_module>', '?', 'acc_id'),
'pathVars' => array('', 'id'),
'method' => 'getOdinName',
'shortHelp' => 'Get a record in custom module',
'longHelp' => '',
)
);
}
function getOdinName($api, $args)
{
return 'something';
}
}
I'm using sugar 7.8.
Thanks for help.
Annamaria