How can I retrieve the new timeline data from the API? - facebook

At the f8-conference Facebook just announced the new timeline view. This is based on the new Open-Graph model
The question is, how is this data retrieved via the API?
Retrieval should address a number of complexities:
The filtered nature should be just like in the online view, i.e. not everything from the ticker should show up
Even more, the granularity of the timeline view should be reflected just like on the webpage (more detail today, less detail in the past, but the option to dig deeper at any time)
The aggregation view of app data should be supported
The cover image should be part of the data
Right now, it is not obvious to me if this is or will be possible at all.

In answer to agam360’s further question in the comments,
But how can we get that "Cover Photos" Id? (looping though all of the Graph data?!)
Use FQL, and take name="Cover Photos" into the WHERE condition of your query too. (But keep in mind that this album name is locale dependend, so if you should be querying the data in another locale than english, you’ll have to adapt the search term.)

Partial answer to the fourth bullet:
There is a new photo album called "Cover Photos" with the cover image on position 1. Unfortunately, there doesn't seem to be a way to find the positioning coordinates that define the viewport on the image.
{edit} There's now a cover field on a user which returns the cover photo and the x/y offset needed to display it the same way it's displayed on Facebook {/edit}

Related

How To Get All Songs of An Artist on Spoitfy?

In their docs for getting top tracks on an artist they mention this:
The 10 maximum tracks are the ones displayed by the Spotify app. If you want to fetch more artist’s top tracks, an alternative way is to use Echo Nest song/search to accomplish this. It will accept a Spotify artist id for input and give you Spotify id’s in the output.
I'm pretty sure the Echo Nest Api no longer exists, so I am wondering if there is still a way to get songs of an artist other than just 10 of them?
Alternatively I was thinking of using Last.fm's Api to do it if Spotify no longer supports that functionality, if anyone has any other suggestions of how one could work around this that would be great! Thanks in advance.
I think you won't be able to achieve it in single API call in Spotify. However there's an alternative:
Request all albums of an artist (have a look here):
https://api.spotify.com/v1/artists/{id}/albums
And then request the tracks of each album (have a look here):
https://api.spotify.com/v1/albums/{id}/tracks
To avoid one request for each album, you can get multiple albums at once and when an album is requested, the tracks of such album will be returned in a paging object. You can pass the desired albums identifiers separated by , in the id query parameter to the following endpoint (have a look here):
https://api.spotify.com/v1/albums
A solution that was more sufficient for me here was:
https://api.spotify.com/v1/search?type=track&q=artist:ArtistName
this returns the top songs by this artist, with pagination so definitely more than 10 results.
The only caveat is that this includes songs that the artist might be featured on, but I think this is useful really as if it's a popular song your user might be looking for it.

Get largest image from Facebook graph api photo node

I'm using the facebook graph api v2.6. I'm accessing the photo's of a user via "me/photos?fields=images". This provides an array of various sizes of the given photo. Obviously I could just run through the list and pick the largest one but I wanted to know if there is a way to limit the results returned to the largest one to reduce the payload size since I only care about the highest resolution one.
Also, please note that "type=normal" does not return the largest image (nor does it seem to work on the photos node anyway) and the "source" field is not the largest image either and that field is depreciated anyway. Thanks.
Update: please note I am not trying to access the profile image of a user, I am trying to access the photos node of the user which is all of the photos they have been tagged in. Here is the documentation: https://developers.facebook.com/docs/graph-api/reference/v2.6/user/photos
It returns a list of photos as documented here: https://developers.facebook.com/docs/graph-api/reference/photo/
The various sized images are in the "images" field and I want to know if I can restrict that to just the largest image. It doesn't appear so in the documentation but Facebook's documentation has been historically lacking...
You want get a picture for a Facebook User?
Try this way
https://graph.facebook.com/user_id/picture?type=large

Get set photo size from within a nested Facebook api call?

I am trying to get a list of all the photos posted within a Facebook event and then check if those photos have any comments. I am then searching those comments and comment replies for keywords. If the comments have the right keyword then I am saving the photo information for further processing at a later step.
My question is how can I return a certain photo size within my nested call.
Here is what I have so far:
{eventID}/?fields=photos{link,picture,comments{from,message,comments}}
This returns all the info I need other than the photo is only a thumbnail and I want a larger version of the photo?
I also want to keep it to one nested call if possible.
Thanks for any help you can provide me.
4/29 UPDATE:
I also tried this:
{eventID}/photos/?fields=images,link,comments{from,message,comments}`
However, this returns all the image sizes related to the photo and I want to be able to choose what size is returned. Is this possible?

Defining how an Open Graph Post is displayed

I'm posting a custom Open Graph object/action to Facebook successfully.
Our production and staging environments each have their own FB app, which are configured identically (except that in our production app, objects and actions are approved, as is our App Details page).
For some reason though, staging is posting with a larger photo with title/description underneath. Production posts have a smaller image with all text to the right.
I don't remember doing anything special on staging, but in the end, we want posts from production to look like they do on staging. Any idea which setting I need to tweak?
UPDATE: I've learned the stories with larger images are called "image-led stories." The only thing that's mentioned in the above link as to how to get this new layout is:
Larger News Feed story layout generated by an Open Graph post using an image size larger than 200 x 200px.
Using the FB debugger, you can see that both images scraped by FB are 600x600:
Story from production (small layout)
Story from staging (large layout)
Frustratingly, there is no setting you can tweak, and it's totally out of your control as to how your posts will display in someone's News Feed. If you want the "image-led" display style, your photos need to be >= 200x200, but other than that, Facebook determines how it's going to display something.
I found this out after a few days of banging my head and reading everything over the web and finally giving up. We shipped the feature and I just told my coworkers there was nothing we could do.
Then, in my News Feed, I saw a coworker's posts, and they were formatted with the small image. Later that day, she sent an email thanking me because she was excited about the OG integration with our site, and the screenshot she sent had her posts in her feed with the large image.
Same person, same posts, different display in two different feeds.
If someone is having this problem you can solve it by setting the following:
1) On open graph console inside action type mark this option --> User Generated Photos - Let users include photos taken with the camera on their device
2) On your SharePhoto setUserGenerated on true.
SharePhoto photo = new SharePhoto.Builder()
.setUserGenerated(true) // Necessary to post a big image
.setBitmap(shareItem.getImage())
.build();

Facebook Open Graph Activity shows blank captions and taller thumbnail image

I have a facebook application that posts to the users Open Graph whenever they beat a level. It posts the score and other information about how they beat the level.
I use the activity feed to look at these open graph posts. I am running into an issue where for one user their activities don't show the captions and the image is bigger.
Screenshot of messed up Activity:
(source: stiqjoy.com)
Screenshot of correct Activity:
(source: stiqjoy.com)
These activities were appearing correctly for the given user, but have recently started not appearing corretly.
I'm a bit stumped as to what the problem could be. I have been playing with the "beat" action and changing some of the captions. I have also changed the Action's properties from time to time. Also, I am giving the open graph post a thumbnail image that is 200x200, instead of the 90x90 that it displays in the Activity feed.
It seems that once this problem starts occurring for a user, it continues to be a problem for every open graph post of that action type that I make for that user.
The weirdest thing is that it continues to work fine for user A, and continues to be broken for user B. It is like something gets messed up for that specific user, and then stays messed up for them.
I'm open to any ideas, and would appreciate any help you can give me.
Edit
I just found it occurring with the "like" action. Except this time, one Activity is wrong and the next activity is right (Both for the same action on different objects) I've looked over both requests in open graph and there is literally no differences, except for the name of the level and object url. I looked at the meta for the object urls and there isn't anything different except for the names of the objects.
I believe you need to set user_generated to false, explicitly, on the image. Also make sure both your og:description and og:title fields are set.
Here is a little more on user_generated images:
iOS - Facebook Open Graph Api -- ensuring that photos are user generated
Please check out the links in the question above:
https://developers.facebook.com/docs/opengraph/howtos/adding-photos-to-stories/