AnsweredAssumed Answered

How do I see all my rest custom end points

Question asked by Nalin Agrawal on Jun 15, 2016
Latest reply on Apr 21, 2017 by sugar.dennis

I just created a new custom REST endpoint, and did quick repair build. But I am not sure if my endpoint has been created or not, because mya rray returned is always a null array.

 

1) created 'LeadInfoTrustedApi.php' at C:\xampp\htdocs\sugarcrm\modules\Leads\clients\base\api, with class name 'LeadInfoTrustedApi'

2) Added these two methods in that class -

public function registerApiRest() {

        return array(

            'getLeadInfoTrusted' => array(

                //request type

                'reqType' => 'POST',

                //endpoint path

                'path' => array('Leads', 'GetLeadInfoTrusted'),

                //endpoint variables

                'pathVars' => array('module', 'action'),

                //method to call

                'method' => 'fn_GetLeadInfoTrusted',

                //short help string to be displayed in the help documentation

                'shortHelp' => 'Does something really useful',

            ),

        );

    }

 

  public function fn_GetLeadInfoTrusted($api, $args){

         global  $db;

         $data = array();

          //some sql things go here....

         return $data;

  }

 

3) Calling this API from my php using -

$leadInfoUrl = $base_url . "/Leads/GetLeadInfoTrusted";

$lead_trusted_info = (array)$Sugarapi->call($leadInfoUrl, 'POST', $trust_arr);

 

4) Did a quick repair build in my local sugar instance.

 

5) It says that the '$lead_trusted_info' array in step 3 is array(0) { } on var_dump.

 

What am I missing?

Outcomes