Facebook Object API - duplicate objects are created

I create objects through the open chart API and attach them to published stories. Both the object and the story are created, and the FB returns an id, as if everything turned out just fine.

However, when sending the object / history for viewing, it turned out that two objects were created (different types of objects), although I was making only one HTTP POST request.

Background

  • Our application uses the namespace 'mynamespace'
  • We created a custom graph public object named 'myobject'
  • We created a custom open action called "myaction"

Request Details:

1) First we create an object:

POST /me/objects/mynamespace:myobject HTTP/1.1\r\nConnection: close\r\nHost: graph.facebook.com\r\nContent-Length: LENGTH\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n 

URI decoded http object:

 access_token=TOKEN&object={"url":"http://url.com","title":"My title","image":"https://imageurl.com","description":"My description"} 

Answer:

 "{\"id\":\"123456789\"}" 

2) Then we create a story (with the specified object):

 POST /me/mynamespace:myaction HTTP/1.1\r\nConnection: close\r\nHost: graph.facebook.com\r\nContent-Length: LENGHT\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n 

URI decoded http object:

 access_token=TOKEN&myobject=123456789&fb:explicitly_shared=true&message=User generated message 

Answer:

 "{\"id\":\"12121212121\"}" 

Expected Result

  • One object of type mynamespace: myobject must be created
  • One story like mynamespace: myaction must be created

Actual result

  • One object of type mynamespace: myobject created
  • One story like mynamespace: myaction is created
  • One object of type Object is created (according to the reviewer)
  • One Post type action is created (according to reviewers)

Only one story appeared in the user’s feed and in the object browser, but the reviewer told us the following: Your action displays more than one published story when the user starts the action. Users should not be surprised that several publications are published for one action in the application. The action I took produced the "post" and the story "myaction".

We looked at (Open Graph → Types), and it turned out that every time we make this request, an object of type "Object" and an action of type "Post" are automatically created / defined! This should be what the reviewer complains about, but we were not able to figure out what we are doing wrong!

Any suggestions on how this can be resolved are greatly appreciated.

Exact error when using Open API APIs

It turns out the same thing happens when you create an object through the Google Graph API. At the same time, the “Object” object and the “Mail” action unexpectedly appear in the section “Open Graph → Types”. Now I see the following causes of this problem:

  • Object / action / history incorrectly configured
  • The reviewer thought it was a problem when in fact it was not
  • This is a FB error

Objects Created Using Graph APIs

When creating an object through the Graph API, this is the resulting object:

 { "id": "4324324234234234", "url": "http://url.com", "type": "mynamespace:myaction", "title": "My title", "image": [ { "url": "https://imageurl.com" } ], "description": "My description", "updated_time": "2013-07-09T14:14:38+0000", "created_time": "2013-07-09T14:14:38+0000", "application": { "id": "432423423423", "name": "appname", "url": "https://www.facebook.com/apps/appurl" }, "is_scraped": false, "post_action_id": "23423423423423423" } 

"post_action_id" seems weird, and when I request this object:

 { "id": "423423423423", "from": { "name": "My name", "id": "234234" }, "start_time": "2013-07-09T14:14:38+0000", "end_time": "2013-07-09T14:14:38+0000", "publish_time": "2013-07-09T14:14:38+0000", "application": { "name": "appname", "namespace": "mynamespace", "id": "432423423423" }, "data": { "object": { "id": "4324324234234234", "url": "http://url.com", "type": "mynamespace:myaction", "title": "My title" } }, "type": "og.posts", "likes": { "count": 0, "can_like": true, "user_likes": false }, "comments": { "count": 0, "can_comment": true, "comment_order": "chronological" } } 

The fact that an object already has an og.posts object associated with it should be considered in this review. I still don't understand why this og.posts object is automatically displayed as an open graph object.

+2
facebook facebook-opengraph
Jul 08 '13 at 13:37
source share
2 answers

The problem is that when the user clicks the "World" button on your site, two Open Graph actions are published, and this contradicts our policy - one user action should not publish multiple stories. If you register as an Open Graph Test user and check the activity log, you will see the following two published actions with the same timestamp:

https://www.facebook.com/100006264788511/activity/1388570951361718 https://www.facebook.com/100006264788511/activity/1388570924695054

Are you sure your code only makes one call to the Graph API when publishing an action?

0
Jul 10 '13 at 0:43
source share

I'm not sure how this will be displayed in your POSTs, but I was dealing with the same problem in iOS, and the problem is placing both the object and the action. If you set object in the other field for an action (instead of objectId after posting), only one action is created. In my case, instead of executing:

 NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPost]; object.provisionedForPost = YES; object[@"title"] = @"Title"; object[@"type"] = @"video.other"; object[@"url"] = url; [FBRequestConnection startForPostOpenGraphObject:object completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { if (!error && [result objectForKey:@"id"]) { NSString* objectId = [result objectForKey:@"id"]; id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject]; action[@"explicitly_shared"] = @"true"; action[@"other"] = objectId; [FBRequestConnection startForPostWithGraphPath:@"me/myNamespace:post" graphObject:action completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { // handle success and failures }]; } }]; 

I had to do:

 NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPost]; object.provisionedForPost = YES; object[@"title"] = @"Title"; object[@"type"] = @"video.other"; object[@"url"] = url; id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject]; action[@"explicitly_shared"] = @"true"; action[@"other"] = object; [FBRequestConnection startForPostWithGraphPath:@"me/myNamespace:post" graphObject:action completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { // handle success and failures }]; 
0
Jan 16 '15 at 16:27
source share



All Articles