public function onLoad() { parent::onLoad(); // get request ip $remoteIp = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; // load app and user $this->app = $this->getApp($this->appId); $this->user = $this->getUser($this->userId); // check rate limit if ($this->rateService->hasExceeded($remoteIp, $this->context->get('fusio.routeId'), $this->app)) { throw new StatusCode\ClientErrorException('Rate limit exceeded', 429); } // log request $this->logId = $this->apiLogger->log($this->context->get('fusio.routeId'), $this->appId, $this->userId, $remoteIp, $this->request); }