TLDR i try to change a setting for one of my facebook-pages by API. The Syntax has changed but i can not figure out how.
whole story
The example code from the docs is:
/* PHP SDK v4.0.0 */
/* make the API call */
$request = new FacebookRequest(
$session,
'POST',
'/{page-id}/settings',
array (
'setting' => 'USERS_CAN_POST_VIDEOS',
'value' => false,
)
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
if i try that i get the following exception:
(#12) 'setting' is deprecated for versions v2.2 and higher
Which seems to be noted in the changelog here
But i can not figure out the new syntax. When i try the following:
$request = new FacebookRequest(
$session,
'POST',
'/{page-id}/settings',
array (
'option' => array(
'USERS_CAN_POST' => true
)
)
);
i get this error:
OAuthException (#100) option requires exactly one key"
And with this syntax:
$request = new FacebookRequest(
$session,
'POST',
'/{page-id}/settings',
array (
'USERS_CAN_POST' => true
)
);
Error this time:
(#100) Requires exactly one and only one of the params: option,setting
So which is the correct syntax to set an option now?
Thanks!
Aucun commentaire:
Enregistrer un commentaire