methods['addStatusDetails_get']['limit'] = 500; // 500 requests per hour per user/key $this->methods['addStatusDetails_post']['limit'] = 100; // 100 requests per hour per user/key $this->methods['addStatusDetails_delete']['limit'] = 50; // 50 requests per hour per user/key $this->methods['getStatusDetails_post']['limit'] = 500; // 50 requests per hour per user/key $this->methods['updateStatusDetails_post']['limit'] = 500; // load the model $this->load->model('Status_model', 'status_model'); } /* * This method used to add status details * created by Surendiran * */ public function addStatusDetails_post() { $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['ListName'] = $this->post('statusName'); $details['ListGroup'] = "1"; $details['CreatedBy'] = $this->post('createdBy'); $details['IsActive'] = $this->post('status'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $statusDetails = $this->status_model->addstatus($details);// Check if the users data store contains users (in case the database result returns NULL) if ($statusDetails) { $statusDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($statusDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'Something went wrong.please try again!', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } /* * get status details * created by Surendiran * */ public function getStatusDetails_post() { $requestedBy = $this->post('requestedBy'); $getStatus = $this->status_model->getStatus($requestedBy); if ($getStatus) { $getStatus['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getStatus, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'No records found!', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } /* * update the status details * created by Surendiran * */ public function updateStatusDetails_post() { $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $ListCode = $this->post('ListCode'); $details['ListName'] = $this->post('ListName'); $details['IsActive'] = $this->post('status'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); $statusDetails = $this->status_model->update($details,$ListCode);// Check if the users data store contains users (in case the database result returns NULL) if ($statusDetails) { $statusDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($statusDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code } else { // Set the response and exit $this->response([ 'message' => 'Something went wrong.please try again!', 'status' => REST_Controller::HTTP_NOT_FOUND ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code } } }