Difference between #16 and #17 of
How-To: Create a REST API

Revision #17 has been created by jwerner on May 15, 2012, 7:21:34 PM with the memo:

Fixed typos. Thanks to waterloomatt
« previous (#16) next (#18) »

Changes

Title unchanged

How-To: Create a REST API

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

REST, API, Tutorial, Backbone

Content changed

[...]
$var, $_GET['model']) );
}
}
// Try to save the model
if($model->save())
$this->
_sendResponse(200, CJSON::encode($model));
else
// prepare the error $msg
[...]
$num = $model->delete();
if($num>0)
$this->
_sendResponse(200, $num); //this is the only way to work with backbone
else
$this->_sendResponse(500,
sprintf("Error: Couldn't delete model <b>%s</b> with ID <b>%s</b>.",
$_GET['model'], $_GET['id']) );
}
[...]
98 2
123 followers
Viewed: 498 250 times
Version: 1.1
Category: How-tos
Written by: jwerner
Last updated by: Rohit Suthar
Created on: Apr 15, 2011
Last updated: 9 years ago
Update Article

Revisions

View all history