AnsweredAssumed Answered

Return bean object in custom endpoint

Question asked by Cristian Chavez on Jul 30, 2016
Latest reply on Aug 12, 2016 by Cristian Chavez

Hi guys,

I created a custom endpoint and I've been trying to return a bean object of a custom module. I tried with something like this but it didn't work:

 

function customFunctionApi($api, $args){

  $id = $args['<some_arg_id>'];

  $CustomBean=BeanFactory::retrieveBean(<custom_module>, $id ,array('disable_row_level_security' => true));

 

  $api = new RestService();

  $api->user = $GLOBALS['current_user'];

  $helper = ApiHelper::getHelper($GLOBALS['service'], $CustomBean);

 

  return $helper->formatForApi($CustomBean);

}

Outcomes