| Server IP : 14.225.204.176 / Your IP : 216.73.216.252 Web Server : nginx/1.24.0 System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 User : root ( 0) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/php/wit-crm/api/controllers/ |
Upload File : |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
require __DIR__.'/REST_Controller.php';
/**
* This is an example of a few basic user interaction methods you could use
* all done with a hardcoded array
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author Phil Sturgeon, Chris Kacerguis
* @license MIT
* @link https://github.com/chriskacerguis/codeigniter-restserver
*/
class Services extends REST_Controller {
function __construct()
{
// Construct the parent class
parent::__construct();
}
/**
* @api {get} api/services Request Services information
* @apiName GetServices
* @apiGroup Services
*
* @apiHeader {String} Authorization Basic Access Authentication token.
*
*
* @apiSuccess {Object} Services information.
*
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "serviceid": "1",
* "name": "Service 1"
* ...
* }
* @apiError {Boolean} status Request status.
*
* @apiErrorExample Error-Response:
* HTTP/1.1 404 Not Found
* {
* "status": false,
* "message": "No data were found"
* }
*/
public function data_get()
{
// If the id parameter doesn't exist return all the
$this->load->model('tickets_model');
$data = $this->tickets_model->get_service();
// Check if the data store contains
if ($data)
{
// 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
}
}
}