termRepository = t3::injectClass( TermRepository::class ); $this->termRepositoryOri = $termRepository; } /** * # Retrieve existing Terms * * Send a simple POST request to retrieve terms by type or category or whatever from the database. * The actual request is made based on the combination of params you provide. * ``` * https://www.this-sites-url.com/api/chatbotterms * ``` * Add your request parameters to the request. * Based on the fields in the db a possible request could be i.e.: * ``` * ?type=gedoens * ``` * which retrieves all terms with type 'gedoens' or * ``` * ?category=obst * ``` * which retrieves all terms of category 'obst' or * ``` * ?type=gedoens&category=obst * ``` * which retrieves all terms with type 'gedoens' and category 'obst' or even * ``` * ``` * which retrieves all terms objects. * * @Api\Access("fe_users") * @Api\Localize() * @Api\Label("/api/chatbotterms") * @return array */ public function getIndexAction() { $requestArgs = $this->getRequest()->getArguments(); $type = $requestArgs['type']; $category = $requestArgs['category']; $termsQueryResults = $this->termRepositoryOri->findAllTermsByTypeOrCategoryOrSimplyAll($type, $category); $response = json_decode(json_encode($termsQueryResults)); return $response; } }