This is the code that I have but I kept getting null as the REST response.
but when I use raw SQL query I am able to get the results that I needed. However i'd prefer to use the Bean module instead of doing sql query.
What am I doing wrong?
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not a Valid Entry Point!');
class SdcImportApi extends SugarApi
{
public function registerApiRest()
{
return array(
'SdcEndPoint' => array(
'reqType' => 'GET',
'noLoginRequired' => true,
'path' => array('SdcEndPoint','GetExample', '?'),
'pathVars' => array('','','contactId'),
'method' => 'MyGetMethod'),
);
}
public function MyGetMethod($api, $args)
{
$contact = BeanFactory::retrieveBean('contacts','f3dc0892-d081-8b8e-dce8-571a703a3593',array('disable_row_level_security' => true));
return $contact;
//global $db;
//$query ="select * from contacts c join contacts_cstm cc on cc.id_c = c.id where c.id = 'f3dc0892-d081-8b8e-dce8-571a703a3593'";
//$result = $db->query($query,true);
//$row = $db->fetchByAssoc($result);
//return $row;
//return $args['contactId'];
}
}
?>