AnsweredAssumed Answered

Whats wrong with this custom API class?

Question asked by James Palmisano on Jul 8, 2016
Latest reply on Jun 23, 2017 by Francesca Shiekh

Hi, I am starting to develop custom API regarding multiple pieces of information we need.  I wanted to just see if I can get the example on sugar developer site to work, but I got this error. Could not find a route with 2 elements



if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

class MyEndpointsApi extends SugarApi
   public function registerApiRest()
   return array(
   'MyGetEndpoint' => array(
   //request type
   'reqType' => 'GET',

   //set authentication
   'noLoginRequired' => false,

   //endpoint path
   'path' => array('MyEndpoint', 'GetExample', '?'),

   //endpoint variables
   'pathVars' => array('', '', 'data'),

   //method to call
   'method' => 'MyGetMethod',

   //short help string to be displayed in the help documentation
   'shortHelp' => 'An example of a GET endpoint',

   //long help to be displayed in the help documentation
   'longHelp' => 'custom/clients/base/api/help/MyEndPoint_MyGetEndPoint_help.html',

  * Method to be used for my MyEndpoint/GetExample endpoint

   public function MyGetMethod($api, $args)
   //custom logic
   return $args;





I am using postman to do the api calls faster. Am I doing this right?


Thanks in advance