Mends.One

(#100) At least one reference object must be specified - Simple POST of OG action

Php, Facebook Graph Api, Facebook

I am using the PHP SDK to try and post a simple action using the Graph API.

I have set up an object called 'Competition' and an action called 'Enter'. As such, a user enters a competition.

My code is like so:

try {
    $statusUpdate = $this->data['facebook']->api('/me/lovepoppycompetition:enter', 'post', array(
        'competition' => 'https://apps.facebook.com/lovepoppycompetition/'
    ));
    echo '<pre>SUCCESS: '.print_r($statusUpdate, true).'</pre>';
} catch(FacebookApiException $e) {
    echo '<pre>FAILED: '.print_r($e, true).'</pre>';    
}   

I am getting an error returned (FacebookApiException):

(#100) At least one reference object must be specified

I'm not really sure why, especially as I am using this code (with different objects/actions) on another app with no issues just fine.

It might be worth noting that I haven't submitted the action, although I don't think I have to for it to work for me?

Thanks in advance.

6
M
Mike
Jump to: Answer 1 Answer 2

Answers (2)

I think the problem lies with you redirecting the action back to your facebook application. You should create a competition page on your website, and use that to redirect users back to your website.

Make sure you use the correct og tags on the redirect page.

0
N
Niraj Shah

This was caused by a FB bug, which is now resolved

0
M
Mike

Comments:

Mike said:
The question is 9 months old, perhaps something has changed? There was an open bug on fb bug tracker at the time, when it was resolved so was my issue
Sumitiscreative said:
This is not written in their doc anywhere. Here are the steps you should follow : goto stories section create a story using your action and object then, you will see manage sample data option below, click on that and create sample object and sample action over there. This will create a separate URL which will be your sample object for reference use this object. Goto types-> press get code and you will get correct code on doing submit at graph API explorer it will generate an ID, which signifies success. (It took me 2 days to figure this out, hope it helps you).

Related Questions