Siqueira
Siqueira

Reputation: 443

Open Graph error on Android app: Action Requires At Least One Reference

I am getting the following error when trying to post an Open Graph story.

Error{FacebookServiceException: httpResponseCode: -1, facebookErrorCode: 1611072, facebookErrorType: null, message: Action
 Requires At Least One Reference: The action you're trying to publish
 is invalid because it does not specify any reference objects. At least
 one of the following properties must be specified: victory.

I did not find anything about this property victory in the documentation.

The code I am using to post the story:

ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
                .putString("og:type", "games")
                .putString("og:title", "<Title>")
                .putString("og:url","<website>")
                .putString("og:image","<image link>")
                .putString("og:description", "Teste")
                .build();

        ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
                .setActionType("games.celebrate")
                .putObject("games", object)
                .build();

        ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
                .setPreviewPropertyName("games")
                .setAction(action)
                .build();

        ShareDialog.show(thisActivity, content);

How can I make it work?

Upvotes: 0

Views: 615

Answers (1)

Dharmishtha
Dharmishtha

Reputation: 1343

According to https://developers.facebook.com/docs/reference/opengraph/action-type/games.celebrate/ you have write your code block as below. try that instead you use, have something changes like "og:type", "games.victory" and .putObject("games:victory", object) . so make changes in code.

ShareOpenGraphObject object = new ShareOpenGraphObject.Builder()
    .putString("og:type", "games.victory")
    .putString("og:title", "QoF")
    .putString("og:url","https://appsonfire33.wixsite.com/website")
    .putString("og:image:url","https://static.wixstatic.com/media/792c0f_ee1843bfce26447ab34eead294163182~mv2.png/v1/fill/w_80,h_80,al_c,usm_0.66_1.00_0.01/792c0f_ee1843bfce26447ab34eead294163182~mv2.png")
    .putString("og:description", "Teste")
    .build();

ShareOpenGraphAction action = new ShareOpenGraphAction.Builder()
    .setActionType("games.celebrate")
    .putObject("games:victory", object)
    .build();

ShareOpenGraphContent content = new ShareOpenGraphContent.Builder()
    .setPreviewPropertyName("games:victory")
    .setAction(action)
    .build();

ShareDialog.show(thisActivity, content);

Hope this Help.

Upvotes: 2

Related Questions