Skip to content
fkmhrk edited this page Sep 12, 2013 · 4 revisions

ObjectAPI

Get ObjectAPI instance

require_once ('<library_root>'. '/src/kii/KiiAppAPI.php');

$context = new KiiContext(APP_ID, APP_KEY, SITE);
$appPpi = new KiiAppAPI($context);
$api = $appApi->objectAPI();

Create new Object

$bucket = new KiiBucket($user, 'post');
$data = array(
		'name' => 'fkm'
		);
try {
	$obj = $api->create($bucket, $data);
} catch (CloudException $e) {
	//error handling
}

Update Object

$obj->data['score'] = 120;
try {
	$obj = $api->update($obj);
} catch (CloudException $e) {
	//error handling
}

$obj is KiiObject.

Delete Object

try {
	$api->delete($obj);
} catch (CloudException $e) {
	//error handling
}

$obj is KiiObject.

Clone this wiki locally