Prototype for "Radically Simplify the Persistence API" RPC/REST

View the source of this page | View the patch to PHP Shindig | Show pretty output newBatch(); $create_params = array( 'userId' => '@me', 'groupId' => '@self', 'appId' => '@app', 'data' => array( 'foo1' => $foo1, 'foo2' => $foo2, 'foo3' => $foo3 ) ); $batch->add($osapi->appdata->create($create_params), 'create_appdata'); $result = $batch->execute(); ?>

Creating App Data using the old syntax

Setting the foo1 parameter to a random number:
Setting the foo2 parameter to the current date:
Setting the foo3 parameter to a string:

getRequestUrl(); ?>

getRequestBody(); ?>
getResponseBody(); ?>
newBatch(); $self_request_params = array( 'userId' => '@me', 'groupId' => '@self', 'fields' => array( 'aboutMe', 'bodyType', 'currentLocation', 'happiestWhen', 'lookingFor', 'appData', ) ); $batch->add($osapi->people->get($self_request_params), 'get_self'); $result = $batch->execute(); ?>

Getting the viewer and all app data using the new syntax

App data returned was getAppData())) ?>

getRequestUrl(); ?>

getRequestBody(); ?>
getResponseBody(); ?>
newBatch(); $self_request_params = array( 'userId' => '@me', 'groupId' => '@self', 'fields' => array( 'appData.foo1', 'appData.foo2' ) ); $batch->add($osapi->people->get($self_request_params), 'get_appdata_by_key'); $result = $batch->execute(); $result_data = $result['get_appdata_by_key']->getAppData(); ?>

Fetching App Data by specific keys

Requested the foo1 parameter:
Requested the foo2 parameter:

getRequestUrl(); ?>

getRequestBody(); ?>
getResponseBody(); ?>
newBatch(); $self_request_params = array( 'userId' => '@me', 'groupId' => '@friends', 'fields' => array( 'appData.foo1', 'appData.foo2', 'appData.foo3', ) ); $batch->add($osapi->people->get($self_request_params), 'get_friends'); $result = $batch->execute(); ?>

Fetching App Data for the current user's friends

(For this to work, you'll need friends who have run this sample. You'll need to register additional test accounts or friend Alice Testington, API Kurrik, or Arne)

getList() as $friend): ?>
getAppData(); ?> getDisplayName() ?> has appdata:
getRequestUrl(); ?>

getRequestBody(); ?>
getResponseBody(); echo ""; ?>