开发者

Getting interests and activities in user specific locale via Graph API

开发者 https://www.devze.com 2023-04-04 17:54 出处:网络
we are working on a mobile app that accesses facebook user data. We want to get the users activities, interests and favorite books, music, etc. We are fetching these information via the Graph API bu

we are working on a mobile app that accesses facebook user data.

We want to get the users activities, interests and favorite books, music, etc. We are fetching these information via the Graph API but now we are facing the problem, that the returned interests are in english language.

That are the steps we are taking to fetch common interests:

1) Get access token

2) Call https: //graph.facebook.com/me/interests&access_token=XXX0&locale=de_DE

The response is somewhat like:

{"data":[{"name":"Programming","category":"Interesse","id":"101882226520576","created_time":"2011-08-02T08:38:03+0000"}]}

You can see, that the category is tanslated, but we are also looking for the german version of the name field ("Programmierung").

When i try to acces开发者_开发百科s the english "Programming"-page on http://www.facebook.com/pages/Programming/101882226520576 i am forwarded to http://www.facebook.com/pages/Programmieren/106375099398136.

Accessing 106375099398136 with Graph API yields the correct response:

{
   "id": "106375099398136",
   "name": "Programmieren",
   "link": "http://www.facebook.com/pages/Programmieren/106375099398136",
   "likes": 6983,
...
}

How do i get this locale dependent link between "Programming"-page and "Programmierung"-page via the Graph API?


just want to share a possible workaround for the above problem.

Basically we are emulating what is happening when the user trys to access a facebook page and is redirected to the localized counterpart. So we are sending a HTTP request to "facebook.com/pages/PAGE_ID" with the user locale set in the HTTP header and follow the redirects until the last location. The URL of the last location is somewhat like "http://www.facebook.com/pages/LOCALIZED_PAGE_NAME/PAGE_ID" and we are extracting the page name from this.

This is an effective but far from efficient solution :) Would appreciate a more elegant way to handle this.

Bye, Tobias

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号