Skip to content

Instantly share code, notes, and snippets.

@chriskacerguis
Created October 18, 2014 19:16
Show Gist options
  • Save chriskacerguis/ff272fa3b958d40b5583 to your computer and use it in GitHub Desktop.
Save chriskacerguis/ff272fa3b958d40b5583 to your computer and use it in GitHub Desktop.
endpoint.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH.'/libraries/REST_Controller.php';
/**
* Class API_Sample
*/
class API_Sample extends REST_Controller
{
/**
* [__construct description]
* @author Chris Kacerguis <[email protected]>
*/
public function __construct()
{
parent::__construct();
}
/**
* get http method, should be used to simply return data
* @author Chris Kacerguis <[email protected]>
* @return [type] [description]
*/
public function index_get()
{
var_dump($this->get());
}
/**
* post http method, should be used to "create" a record
* @author Chris Kacerguis <[email protected]>
* @return [type] [description]
*/
public function index_post()
{
var_dump($this->post());
}
/**
* put http method, should be used to "update" a record
* @author Chris Kacerguis <[email protected]>
* @return [type] [description]
*/
public function index_put()
{
var_dump($this->put());
}
/**
* delete http method, should be used to "delete" a record
* @author Chris Kacerguis <[email protected]>
* @return [type] [description]
*/
public function index_delete()
{
var_dump($this->delete());
}
}
/* End of file api_sample.php */
/* Location: ./application/controllers/api/api_sample.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment