22

グラフ 2 アクションでグラフ API を使用して facepile のようなことをしたいと思います。カスタム オブジェクトとカスタム オブジェクトから、このオブジェクトでこのアクションを実行した友人 (Facebook アプリケーションを使用) を教えてください。

問題は、FQL を使用してカスタム オブジェクトとアクションをクエリできないことです。グラフ API を使用して、友人のリストと興味のあるオブジェクトを交差させる方法が見つかりません。

私ができる最善のことは、グラフAPIのバッチモードを使用して次のことでした:

batch=[
  // First we get the list of friends that are using my facebook application
  { "method": "GET", "relative_url": "fql?q=SELECT+uid+FROM+user+WHERE+uid+IN+(SELECT+uid1+FROM+friend+WHERE+uid2=me())+AND+is_app_user=1+LIMIT+0,49", "name": "friends"},
  // Then query each friend to get the list of objects that went through my namespace:testaction
  { "method": "GET", "relative_url": "{result=friends:$.data.0.uid}/namespace:testaction" },
  { "method": "GET", "relative_url": "{result=friends:$.data.1.uid}/namespace:testaction" },
  ...
  { "method": "GET", "relative_url": "{result=friends:$.data.49.uid}/namespace:testaction" }
]

それは非常に非効率的であり、私の問題を完全には解決していません:

  • 結果をフィルタリングして、必要なオブジェクトに一致するものだけを取得する必要があります
  • 名前空間:testaction に多数のオブジェクトがある場合、ページングを実行して、より多くのクエリを実行する必要があります (クエリの数を最小限に抑えようとします)。

これを行うためのより良い方法が見えますか?

4

3 に答える 3

6

This probably isn't exactly what you're looking for, but given the fact that facebook (AFAIK) doesn't provide (and will probably never provide) the ability to do this. I think you should simply store the information yourself and then query the data from your own database. It would be like what you're doing in your question, but you can optimize it since it's your database.

I'm sure you thought about this already, but someone had to say it.

于 2012-02-13T21:22:11.280 に答える
3

derickitoが提供した答えが十分でない場合は、アプリをFacebookのホワイトリストに載せて(別名パートナーになる)、この機能が存在する可能性があるが「通常の」アプリケーションでは利用できないプライベートグラフAPIを取得することを検討する必要がありますパブリック グラフ API を使用してスタックしている。

于 2012-02-15T16:05:06.400 に答える
3

1 つの Graph API リクエストでこれを実行できるようになりました。

GET https://graph.facebook.com/me/friends?limit=50&fields=name,namespace:testaction.limit(100)

フィールドの拡張グラフ API の更新を参照してください。

于 2012-09-03T13:36:44.760 に答える