Api_model->get_table('invoice_items', $id); // Check if the data store contains if ($data) { $data = $this->Api_model->get_api_custom_data($data, "items", $id); // Set the response and exit $this->response($data, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response(['status' => FALSE, 'message' => 'No data were found'], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } /** * @api {get} api/items/search/:keysearch Search Invoice Item's information * @apiVersion 0.1.0 * @apiName GetItemSearch * @apiGroup Items * * @apiHeader {String} authtoken Authentication token, generated from admin area * * @apiParam {String} keysearch Search Keywords * * @apiSuccess {Object} Item Item Information * * @apiSuccessExample Success-Response: * HTTP/1.1 200 OK * { * "rate": "100.00", * "id": "1", * "name": "(100.00) JBL Soundbar", * "subtext": "The JBL Cinema SB110 is a hassle-free soundbar..." * } * * @apiError {Boolean} status Request status * @apiError {String} message No data were found * * @apiErrorExample Error-Response: * HTTP/1.1 404 Not Found * { * "status": false, * "message": "No data were found" * } */ public function data_search_get($key = '') { $data = $this->Api_model->search('invoice_items', $key); // Check if the data store contains if ($data) { $data = $this->Api_model->get_api_custom_data($data, "items"); // Set the response and exit $this->response($data, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response(['status' => FALSE, 'message' => 'No data were found'], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } }