Data.createObjectType
From Facebook Developers Wiki
An object type is like a "table" in SQL terminology, or a "class" in object-oriented programming concepts. Each object type has a unique human-readable "name" that will be used to identify itself throughout the API. Each object type also has a list of properties that one has to define individually. Each property is like a "column" in an SQL table, or a "data member" in an object class.
Contents |
[edit] Parameters
| Type | Name | Description |
|---|---|---|
| string | api_key | The application key associated with the calling application. |
| string | session_key | The session key of the logged in user. |
| float | call_id | The request's sequence number. Each successive call for any session must use a sequence number greater than the last. We suggest using the current time in milliseconds, such as PHP's microtime(true) function. |
| string | sig | An MD5 hash of the current request and your secret key, as described in the authentication guide. |
| string | v | This must be set to 1.0 to use this version of the API. |
| string | format | Optional - desired response format. Either "XML" (default) or "JSON". |
| string | callback | Optional - wrap the response inside a function call. This is primarily to enable cross-domain javascript requests using the <script> tag, sometimes known as "JSONP". This works with both XML and JSON. |
| string | name | Name of this new object type. This name needs to be unique among all object types and associations defined for this application. This name also needs to be a valid identifier, which is no longer than 32 characters, starting with a letter (a-z) and consisting of only small letters (a-z), numbers (0-9) and/or underscores. |
[edit] Return Value
(none)
[edit] PHP Client Coding Examples
First, get the latest version of the Facebook PHP API implementation.
wget http://developers.facebook.com/clientlibs/facebook-platform.tar.gz tar zxvf facebook-platform.tar.gz cp facebook-platform/client/facebook.php . cp facebook-platform/client/facebookapi_php5_restlib.php . rm -rf facebook-platform.tar.gz facebook-platform
<?php
$facebook = new Facebook($key,$secret);
$str = foo_gen_name();
$facebook->api_client->call_method('facebook.data.createObjectType', array('name'=>$str));
//or $facebook->api_client->data_createObjectType($str);
unset($facebook);
?>
<?php require_once 'facebook.php'; $appapikey = 'ce132c2084f5b73e771f8042e43a4977'; $appsecret = '38228e02638eb2a11ca34c5c618a9f02'; $facebook = new Facebook($appapikey, $appsecret); $user = $facebook->require_login(); //[todo: change the following url to your callback url] $appcallbackurl = 'http://www.simpsonizeme.com/home.php?auth_token=abc123'; //catch the exception that gets thrown if the cookie has an invalid session_key in it try { if (!$facebook->api_client->users_isAppAdded()) { $facebook->redirect($facebook->get_add_url()); } } catch (Exception $ex) { //this will clear cookies for your application and redirect them to a login prompt $facebook->set_user(null, null); $facebook->redirect($appcallbackurl); } ?>
<?php require_once 'appinclude.php'; echo "<p>hello $user</p>"; ?>
[edit] FQL Equivalent
(none)
[edit] Error codes
| Code | Description |
|---|---|
| 1 | An unknown error occurred. Please resubmit the request. |
| 2 | The service is not available at this time. |
| 4 | The application has reached the maximum number of requests allowed. More requests are allowed once the time window has completed. |
| 5 | The request came from a remote address not allowed by this application. |
| 100 | One of the parameters specified was missing or invalid. |
| 101 | The api key submitted is not associated with any known application. |
| 102 | The session key was improperly submitted or has reached its timeout. Direct the user to log in again to obtain another key. |
| 103 | The submitted call_id was not greater than the previous call_id for this session. |
| 104 | Incorrect signature. |
| 200 | Permission denied. Calling application or user doesn't have enough permissions to perform the action. |
| 800 | Internal error. Please report this to Facebook when getting this error. |
| 801 | Invalid operation error. This operation is not allowed. |
| 802 | Quota exceeded. Certain maximum number allocated for an application or a user is exceeded. |
| 804 | Object already exists on server. |
| 805 | A temporary database failure happened. Usually this can be corrected by a re-try. |
