Added API

This commit is contained in:
Marek Sebera 2013-01-23 01:11:20 +01:00
parent 094b89463a
commit b60a06e76b
2 changed files with 41 additions and 1 deletions

View file

@ -8,4 +8,13 @@ class ItemsController extends AppController {
'maxLimit' => 1000
);
public function json_all(){
die(json_encode($this->Item->find('all')));
}
public function json_find($id = null){
if($id == null || !is_numeric($id)) die(json_encode(array("error"=>true)));
else die(json_encode($this->Item->find('all',array('conditions'=>array('barcode ='=>$id)))));
}
}