Starting last month, it appears that community pages either require a user access token to access the graph image, or will not allow application to access the image.
As an example: The community page for Harold and Maude (105636526135846), last month would return a picture -- now calls to the graph do not include the picture string.
{
"id": "105636526135846",
"name": "Harold and Maude",
"link": "http://www.facebook.com/pages/Harold-and-Maude/105636526135846",
"likes": 143886,
"category": "Movie",
"is_community_page": true,
...
At one point it appeared that using an access token would work, however, now requesting '/105636526135846/picture' returns no picture and Facebook's embedded image is
http://external.ak.fbcdn.net/safe_image.php?d=AQBKNDbD3RCI0MXv&w=180&h=540&url=http%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fen%2Fc%2Fc4%2FHarold_and_maude.jpg&fallback=hub_movie
Alternatively FQL appears to return the proper information
>[
>> {
>>> "pic": "http://external.ak.fbcdn.net/safe_image.php?d=AQA4PX9DD7wlHZmC&w=100&h=300&url=http%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fen%2Fc%2Fc4%2FHarold_and_maude.jpg&fallback=hub_movie",<br />
>>> "pic_large": "http://external.ak.fbcdn.net/safe_image.php?d=AQBKNDbD3RCI0MXv&w=180&h=540&url=http%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fen%2Fc%2Fc4%2FHarold_and_maude.jpg&fallback=hub_movie"<br />
>> }<br />
>]
Is there something I'm missing with the graph? I'm concerned that the FQL method may stop working.
Wikipedia have started blocking certain images, based on their licensing. So Facebook runs it through a filter (safe_image.php) to check if it is allowed or not. If not, you get a default image. So using FQL will 'sometimes' return you a usable image, but the graph no longer will.
I have no idea if Facebook plan to continue offering the FQL call. Sorry!
Related
While this question has been asked a lot, I've still haven't find a way to do it.
I'm passing this to Graph Api Explorer
40796308305/?fields=feed{full_picture,created_time,message,likes}
this gives me the, Picture to every status, created time , message - user status and likes which gives me array of data and users that likes the status.
i'm trying to get count of those users and remember there were a field 'summary' but I don't see it in the JSON Results.
Am I missing something with 2.4 api version ?
any help will be appreciate.
You need to request the summary:
/40796308305/?fields=feed{full_picture,created_time,message,likes.summary(1)}
And if you are only interested in the total count, but not the individual users that liked, you might want to set the limit for likes to 0, so as not to request unnecessary data:
/40796308305/?fields=feed{full_picture,created_time,message,likes.limit(0).summary(1)}
I was wondering if there is any way to get user checkin information for different places based on the place_id. Facebook documentation keeps changing around and I'm not sure if this is possible now? Seems like it was possible in older API versions.
Any help will be greatly appreciated.Thanks
Checkins are deprecated since Graph API v2.0. You can get the total count (field were_here_count) of checkins to a place with a call like
GET /BrandenburgerTorBerlin?fields=id,name,were_here_count
which gives the result
{
"id": "145183205532558",
"name": "Brandenburger Tor",
"were_here_count": 128511
}
I'm getting started developing a facebook game and I'm hitting some problems in my understanding straight away. I'm hoping there's someone wise out there who can set me straight.
Like most games I want to be able to invite people to join, and then to know when they HAVE joined.
I am using Graph Api version 2.2 - as I understand that version 1.0 will be switched off come April 2015. The issue I am getting to here is that the IDs / tags are 'temporary' so there will be a problem matching them up.
Using this I can request a list of friends that already have the app installed. (great). And I (should) receive back a list of IDs for these players. I can then send them an AppRequest which will prompt them to load up the game. (good so far).
At this point lets assume that one of more friends all load up the game. Also assume that I have some back end processing on my server so each of these friends can say to the server "I have the game loaded, and I know 'my' ID these friend IDs".
In the game I'd then like to show a list of my current friends that actually have the game running - right now. This will be possible because the server know's everyone's ID, and my ID, so it can say "here are the friends that you know..."
I hope you are still following me.
So can the Graph API 2.2 request both
(a) My own ID (??)
(b) My friend's IDs.
- which are matchable and expire at the same period of time. (yes, I know this one is possible)
Is (a) possible? An even if it is, is it an ID that is matchable to temporary friend IDs or is it of another type that can be used for different purposes. (for instance I read that the taggableFriend IDs cannot be used for appRequests).
If it is not possible can anyone explain to me the correct approach?
It seems to me that in the remaining days of Graph API 1.0 you don't have these problems as
(a) You can get your own ID using the FQL interface,
and (b) IDs are permanent so you can store them away in a database to save on these matching problems.
For instance, in Api 1.0 each running instance of the app would be able to get away with only requesting it's own facebook owner's ID. (no friends). - so long as friends had been asked at some point in the past. Your own server would have enough info to be able to match them up and say "I knkow these IDs are your friends still".
But how do I do it in Graph API 2.0 ?
I won't have my game finished before April 2015 so there is really no point in using the older API.
There is probably a lot of stuff in here you already know but I think it would be best if I start from scratch just to get thoughts aligned.
User ID
There are currently two types of IDs for users available
Global ID
App scoped ID
Most if not all applications moving forward should be using the app scoped ID.
User Friends
As long as you request user_friends permission you will get a list of friends also using the application.
Invitable Friends API
As long as your app is a game on canvas you will be returned a full list of user's friends that you can invite via invite Tokens. These tokens are temporary and can be used in the Request Dialog.
Now to your scenario, your game is running and the /me/friends list returns
{
"data": [
],
"summary": {
"total_count": 5000
}
}
So, no friends are currently in the game. You invite friends using invite tokens from /me/invitable_friends and one of your friends join.
Recall `/me/friends`
{
"data": [
{
"name": "phwd friend lastname",
"id": "app-scoped-id-1"
}
],
"paging": {
"next": "https://graph.facebook.com/v2.2/me/friends..."
},
"summary": {
"total_count": 5000
}
}
So app-scoped-id-1 (which will be a numeric) is the app scoped ID of your friend. This should not change.
So the ids that you will store are
/me?fields=id the current player
/me/friends?fields=id the player's friends who are also playing
Hi all,
I'm new to REST and Web API. I'm a bit confused on how to design URIs for my resources.
Given that I have a domain with the following resources: Blogs, Posts and Users.
Blog (1) ------ (0..*) Post (0..*) ------ (1) User
A blog can have many posts and each post is associated with one blog. An user can have many posts and each post is associated with one user.
For Blog and User resources the URIs would be like the following:
GET /blogs - get list of all blogs
GET /blogs/{id} - get blog by id
POST /blogs - create new blog
PUT /blogs/{id} - update blog
DELETE /blogs/{id} - delete blog
GET /users- get list of all users
GET /users/{id} - get user by id
POST /users - create new user
PUT /users/{id} - update user
DELETE /users/{id} - delete user
But what about Posts resource? How to handle associations? I'm thinking of the following alternatives - which ones are correct and why?
-- Get all posts by blog
1. GET /blogs/{id}/posts
or
2. GET /posts?blogid={id}
-- Create new post in a blog
3. POST /blogs/{id}/posts
or
4. POST /posts (here I would then in the payload send the IDs of the resources this post is associated with. BlogId and UserId)
-- Get all posts by blog and by user
5. GET /blogs/{id}/posts?userid={id}
or
6. GET /posts?blogid={id}&userid={id}
If anyone could point me in the right direction here, I'd be grateful.
Since a post is always associated with a blog and a user ID, I would choose options 1, 3 and 5:
GET /blogs/{id}/posts
POST /blogs/{id}/posts
GET /blogs/{id}/posts?userid={id}
The first question you should ask yourself is how important it is to you that your API is truly RESTful? It's actually a lot more fiddly than it seems to achieve this.
Is your API going to be consumed only by your own software\organisation?
Will your API be accompanied by documentation?
If the answer to 1 or 2 above is true, then the value of being truly RESTful is questionable... it's all or nothing with REST so either you go the whole hog or you don't worry.
For an API to be a true REST API, it must be discoverable from a single entry point (see here: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven). Each call should return information on other related calls that can be made on that resource.. usually via links of some kind, this is one possible structure:
{
"Id" : 1,
"Identifier" : "123's First Blog",
"links" : [
{
"rel": "http://myapi/res/posts",
"href": "http://myapi/blog/1/posts"
},
{
"rel": "http://myapi/res/users",
"href": "http://myapi/user/123"
}
]
}
The rel is a link to a summary\definition of the resource, and the href should point to the api itself.
Anyways, the point of all this is that if you do want to be truly RESTful, then let the links between resources and uris dictate the design. Think about how you would discover the particulars for each call from a single starting point, and the structure should reveal itself much like software design through TDD.
If you don't need to be RESTful, then things become much simpler. Just design your API in the most natural way for you, your architecture, and your developers. If you document things properly, then this will lead to a much more efficient API and one that is quicker to develop against.
Mario's answer to this question is sound, and I would also favour those options over the others. I just thought you should know the whole story that accompanies such a desicion.
If this doesn't make sense or you would like more information then post a comment and I'll try to help :)
Trying to figure out the correct Json string to pass to my OpenGraph app. I'm using the Gigya Java SDK, but decided to eliminate some of the extra layers in testing the string.
So I'm first of all looking at the Graph API Explorer.
My POST field name is "Recipe" and the value is
{"title":"one-handed fried pies","description":"ye olde Description goeth here.","image":"http://www.recipe.com/images/one-handed-fried-pies-R094255-ss.jpg","url":"http://www.recipe.com/one-handed-fried-pies/"}
This maps exactly to the fields of the Recipe object.
However, no matter how I format the JSON, I get this exception
{
"error": {
"message": "(#3503) \"{\"title\":\"one-handed fried pies\",\"description\":\"ye olde Description goeth here.\",\"image\":\"http://www.recipe.com/images/one-handed-fried-pies-R094255-ss.jpg\",\"url\":\"http://www.recipe.com/one-handed-fried-pies/\"}\" is an invalid value for property \"recipe\" with type \"Reference\"",
"type": "OAuthException",
"code": 3503
}
}
Any thoughts?
By hacking thru, got it to work this way.
Most important... the URL as above must point to a page that has valid og: tags for the app. (You can look at the source of this page for the structure http://www.csmonitor.com/Science)
In the Graph Api Explorer,Select your Application in the top left.
Click get Access token.
Select POST.
Click on Add a field
Type the name of the object. In my case "recipe".
Type the url. In my case, I set up a live test page and deployed it.
click submit and wait for an id.
{
"id": "290473937742173"
}