original_string: public function process()
      {
          // read the format requested for the output data
          $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $this->request));
  
          $disablePostProcessing = $this->shouldDisablePostProcessing();
  
          // create the response
          $response = new ResponseBuilder($outputFormat, $this->request);
          if ($disablePostProcessing) {
              $response->disableDataTablePostProcessor();
          }
  
          $corsHandler = new CORSHandler();
          $corsHandler->handle();
  
          $tokenAuth = Common::getRequestVar('token_auth', '', 'string', $this->request);
          $shouldReloadAuth = false;
  
          try {
              ++self::$nestedApiInvocationCount;
  
              // IP check is needed here as we cannot listen to API.Request.authenticate as it would then not return proper API format response.
              // We can also not do it by listening to API.Request.dispatch as by then the user is already authenticated and we want to make sure
              // to not expose any information in case the IP is not whitelisted.
              $whitelist = new LoginWhitelist();
              if ($whitelist->shouldCheckWhitelist() && $whitelist->shouldWhitelistApplyToAPI()) {
                  $ip = IP::getIpFromHeader();
                  $whitelist->checkIsWhitelisted($ip);
              }
  
              // read parameters
              $moduleMethod = Common::getRequestVar('method', null, 'string', $this->request);
  
              list($module, $method) = $this->extractModuleAndMethod($moduleMethod);
              list($module, $method) = self::getRenamedModuleAndAction($module, $method);
  
              PluginManager::getInstance()->checkIsPluginActivated($module);
  
              $apiClassName = self::getClassNameAPI($module);
  
              if ($shouldReloadAuth = self::shouldReloadAuthUsingTokenAuth($this->request)) {
                  $access = Access::getInstance();
                  $tokenAuthToRestore = $access->getTokenAuth();
                  $hadSuperUserAccess = $access->hasSuperUserAccess();
                  self::forceReloadAuthUsingTokenAuth($tokenAuth);
              }
  
              // call the method
              $returnedValue = Proxy::getInstance()->call($apiClassName, $method, $this->request);
  
              // get the response with the request query parameters loaded, since DataTablePost processor will use the Report
              // class instance, which may inspect the query parameters. (eg, it may look for the idCustomReport parameters
              // which may only exist in $this->request, if the request was called programatically)
              $toReturn = Context::executeWithQueryParameters($this->request, function () use ($response, $returnedValue, $module, $method) {
                  return $response->getResponse($returnedValue, $module, $method);
              });
          } catch (Exception $e) {
              StaticContainer::get(LoggerInterface::class)->error('Uncaught exception in API: {exception}', [
                  'exception' => $e,
                  'ignoreInScreenWriter' => true,
              ]);
  
              $toReturn = $response->getResponseException($e);
          } finally {
              --self::$nestedApiInvocationCount;
          }
  
          if ($shouldReloadAuth) {
              $this->restoreAuthUsingTokenAuth($tokenAuthToRestore, $hadSuperUserAccess);
          }
  
          return $toReturn;
      }
code: public function process()
      {
          // read the format requested for the output data
          $outputFormat = strtolower(Common::getRequestVar('format', 'xml', 'string', $this->request));
  
          $disablePostProcessing = $this->shouldDisablePostProcessing();
  
          // create the response
          $response = new ResponseBuilder($outputFormat, $this->request);
          if ($disablePostProcessing) {
              $response->disableDataTablePostProcessor();
          }
  
          $corsHandler = new CORSHandler();
          $corsHandler->handle();
  
          $tokenAuth = Common::getRequestVar('token_auth', '', 'string', $this->request);
          $shouldReloadAuth = false;
  
          try {
              ++self::$nestedApiInvocationCount;
  
              // IP check is needed here as we cannot listen to API.Request.authenticate as it would then not return proper API format response.
              // We can also not do it by listening to API.Request.dispatch as by then the user is already authenticated and we want to make sure
              // to not expose any information in case the IP is not whitelisted.
              $whitelist = new LoginWhitelist();
              if ($whitelist->shouldCheckWhitelist() && $whitelist->shouldWhitelistApplyToAPI()) {
                  $ip = IP::getIpFromHeader();
                  $whitelist->checkIsWhitelisted($ip);
              }
  
              // read parameters
              $moduleMethod = Common::getRequestVar('method', null, 'string', $this->request);
  
              list($module, $method) = $this->extractModuleAndMethod($moduleMethod);
              list($module, $method) = self::getRenamedModuleAndAction($module, $method);
  
              PluginManager::getInstance()->checkIsPluginActivated($module);
  
              $apiClassName = self::getClassNameAPI($module);
  
              if ($shouldReloadAuth = self::shouldReloadAuthUsingTokenAuth($this->request)) {
                  $access = Access::getInstance();
                  $tokenAuthToRestore = $access->getTokenAuth();
                  $hadSuperUserAccess = $access->hasSuperUserAccess();
                  self::forceReloadAuthUsingTokenAuth($tokenAuth);
              }
  
              // call the method
              $returnedValue = Proxy::getInstance()->call($apiClassName, $method, $this->request);
  
              // get the response with the request query parameters loaded, since DataTablePost processor will use the Report
              // class instance, which may inspect the query parameters. (eg, it may look for the idCustomReport parameters
              // which may only exist in $this->request, if the request was called programatically)
              $toReturn = Context::executeWithQueryParameters($this->request, function () use ($response, $returnedValue, $module, $method) {
                  return $response->getResponse($returnedValue, $module, $method);
              });
          } catch (Exception $e) {
              StaticContainer::get(LoggerInterface::class)->error('Uncaught exception in API: {exception}', [
                  'exception' => $e,
                  'ignoreInScreenWriter' => true,
              ]);
  
              $toReturn = $response->getResponseException($e);
          } finally {
              --self::$nestedApiInvocationCount;
          }
  
          if ($shouldReloadAuth) {
              $this->restoreAuthUsingTokenAuth($tokenAuthToRestore, $hadSuperUserAccess);
          }
  
          return $toReturn;
      }
code_tokens: public function process ( ) { // read the format requested for the output data $ outputFormat = strtolower ( Common :: getRequestVar ( 'format' , 'xml' , 'string' , $ this -> request ) ) ; $ disablePostProcessing = $ this -> shouldDisablePostProcessing ( ) ; // create the response $ response = new ResponseBuilder ( $ outputFormat , $ this -> request ) ; if ( $ disablePostProcessing ) { $ response -> disableDataTablePostProcessor ( ) ; } $ corsHandler = new CORSHandler ( ) ; $ corsHandler -> handle ( ) ; $ tokenAuth = Common :: getRequestVar ( 'token_auth' , '' , 'string' , $ this -> request ) ; $ shouldReloadAuth = false ; try { ++ self :: $ nestedApiInvocationCount ; // IP check is needed here as we cannot listen to API.Request.authenticate as it would then not return proper API format response. // We can also not do it by listening to API.Request.dispatch as by then the user is already authenticated and we want to make sure // to not expose any information in case the IP is not whitelisted. $ whitelist = new LoginWhitelist ( ) ; if ( $ whitelist -> shouldCheckWhitelist ( ) && $ whitelist -> shouldWhitelistApplyToAPI ( ) ) { $ ip = IP :: getIpFromHeader ( ) ; $ whitelist -> checkIsWhitelisted ( $ ip ) ; } // read parameters $ moduleMethod = Common :: getRequestVar ( 'method' , null , 'string' , $ this -> request ) ; list ( $ module , $ method ) = $ this -> extractModuleAndMethod ( $ moduleMethod ) ; list ( $ module , $ method ) = self :: getRenamedModuleAndAction ( $ module , $ method ) ; PluginManager :: getInstance ( ) -> checkIsPluginActivated ( $ module ) ; $ apiClassName = self :: getClassNameAPI ( $ module ) ; if ( $ shouldReloadAuth = self :: shouldReloadAuthUsingTokenAuth ( $ this -> request ) ) { $ access = Access :: getInstance ( ) ; $ tokenAuthToRestore = $ access -> getTokenAuth ( ) ; $ hadSuperUserAccess = $ access -> hasSuperUserAccess ( ) ; self :: forceReloadAuthUsingTokenAuth ( $ tokenAuth ) ; } // call the method $ returnedValue = Proxy :: getInstance ( ) -> call ( $ apiClassName , $ method , $ this -> request ) ; // get the response with the request query parameters loaded, since DataTablePost processor will use the Report // class instance, which may inspect the query parameters. (eg, it may look for the idCustomReport parameters // which may only exist in $this->request, if the request was called programatically) $ toReturn = Context :: executeWithQueryParameters ( $ this -> request , function ( ) use ( $ response , $ returnedValue , $ module , $ method ) { return $ response -> getResponse ( $ returnedValue , $ module , $ method ) ; } ) ; } catch ( Exception $ e ) { StaticContainer :: get ( LoggerInterface :: class ) -> error ( 'Uncaught exception in API: {exception}' , [ 'exception' => $ e , 'ignoreInScreenWriter' => true , ] ) ; $ toReturn = $ response -> getResponseException ( $ e ) ; } finally { -- self :: $ nestedApiInvocationCount ; } if ( $ shouldReloadAuth ) { $ this -> restoreAuthUsingTokenAuth ( $ tokenAuthToRestore , $ hadSuperUserAccess ) ; } return $ toReturn ; }
docstring: Dispatches the API request to the appropriate API method and returns the result
  after post-processing.
  
  Post-processing includes:
  
  - flattening if **flat** is 0
  - running generic filters unless **disable_generic_filters** is set to 1
  - URL decoding label column values
  - running queued filters unless **disable_queued_filters** is set to 1
  - removing columns based on the values of the **hideColumns** and **showColumns** query parameters
  - filtering rows if the **label** query parameter is set
  - converting the result to the appropriate format (ie, XML, JSON, etc.)
  
  If `'original'` is supplied for the output format, the result is returned as a PHP
  object.
  
  @throws PluginDeactivatedException if the module plugin is not activated.
  @throws Exception if the requested API method cannot be called, if required parameters for the
  API method are missing or if the API method throws an exception and the **format**
  query parameter is **original**.
  @return DataTable|Map|string The data resulting from the API call.
docstring_tokens: Dispatches the API request to the appropriate API method and returns the result after post - processing .