methods['addCertificateDetails_get']['limit'] = 500; // 500 requests per hour per user/key $this->methods['addCertificateDetails_post']['limit'] = 100; // 100 requests per hour per user/key $this->methods['addCertificateDetails_delete']['limit'] = 50; // 50 requests per hour per user/key $this->methods['getCertificateDetails_post']['limit'] = 500; // 50 requests per hour per user/key $this->methods['updateCertificateDetails_post']['limit'] = 500; // load the model $this->load->model('Certificate_model', 'certificate_model'); } /* * This method used to add Certificate details * created by Surendiran * */ public function addCertificateDetails_post() { $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $details['CertificateName'] = $this->post('certificateName'); $details['CreatedBy'] = $this->post('createdBy'); $details['IsActive'] = $this->post('status'); $details['CreatedOn'] = $now->format('Y-m-d H:i:s'); $certificateDetails = $this->certificate_model->addcertificate($details);// Check if the users data store contains users (in case the database result returns NULL) if ($certificateDetails) { $certificateDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($certificateDetails, 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 Certificate details * created by Surendiran * */ public function getCertificateDetails_post() { $requestedBy = $this->post('requestedBy'); $getCertificate = $this->certificate_model->getCertificate($requestedBy); if ($getCertificate) { $getCertificate['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($getCertificate, 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 Certificate details * created by Surendiran * */ public function updateCertificateDetails_post() { $now = new DateTime(); $now->setTimezone(new DateTimezone('Asia/Kolkata')); $updateID = $this->post('updateID'); $details['CertificateName'] = $this->post('certificateName'); $details['IsActive'] = $this->post('status'); $details['UpdatedBy'] = $this->post('updatedBy'); $details['UpdatedOn'] = $now->format("Y-m-d H:i:s"); $certificateDetails = $this->certificate_model->update($details,$updateID);// Check if the users data store contains users (in case the database result returns NULL) if ($certificateDetails) { $certificateDetails['status'] = REST_Controller::HTTP_OK; // Set the response and exit $this->response($certificateDetails, 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 } } }