Facebook Graph Basic Root Information returns false (Likes) - facebook

I'm trying to access the 'likes' from the following facebook page:
http://graph.facebook.com/EncuentrodeNoviosMexico
And I get the following response:
"false"
Trying to access other pages and I do get the information.
The idea is to get the 'Likes' through php or jquery/javascript (I would think through a JSON).
Questions:
1. Why does it return "false"? (Cause)
2. Is there a solution to it or an alternative to get the 'likes' from the page? (Posible Solutions)

For some reason, you need an access token to get your page's information. That is not true for some other pages like https://graph.facebook.com/cocacola.
You can do this by appending &access_token=... to the end of your URL.
You probably need to visit your page's Manage section and edit the settings to make it publicly visible. I'm guessing if you have country or age restrictions on your page, Facebook won't show it to anyone except for authenticated users.

The Graph API Explorer returns the following with "likes" included. Can you revise your question to include the code that does not work properly?
{
"id": "147931875220982",
"name": "Encuentro de Novios México",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/203568_147931875220982_3653853_s.jpg",
"link": "http://www.facebook.com/EncuentrodeNoviosMexico",
"likes": 1135,
"category": "Education",
"is_published": true,
"website": "www.encuentrodenovios.org",
"username": "EncuentrodeNoviosMexico",
"about": "El ENCUENTRO DE NOVIOS es un Movimiento Católico que ofrece la experiencia de un Fin de Semana, para todas aquellas parejas de novios que deseen tener una preparación pre y post matrimonial, para vivir su relación como pareja sacramentada.",
"can_post": true,
"talking_about_count": 4,
"type": "page"
}

There were restrictions by country; when I eliminated them I got full access to the graph API.
Thanks to everyone.
If they wouldn't have granted me access to the page I would have had to do what cpilko suggested. (Thanks cpilko)

Related

Azure Bing Web Search api , retrieve metadata

There's any way to get meta-data that's shown on bing website on Bing Web Search api?
I mean, extract from api response (title, connections, industry, location) information like is in website:
The api response only returns snippet info and this meta-data is not returned.
{
"id": "https://api.cognitive.microsoft.com/api/v7/#WebPages.1",
"name": "Foo Bar - Thing - Thing Company | LinkedIn",
"url": "https://es.linkedin.com/in/foo-bar-041756111",
"isFamilyFriendly": true,
"displayUrl": "https://es.linkedin.com/in/foo-bar-041756111",
"snippet": "Ve el perfil de Foo Bar en LinkedIn, la mayor red profesional del mundo. Foo tiene 2 empleos empleos en su perfil. Ve el perfil completo en LinkedIn y descubre los ...",
"dateLastCrawled": "2018-05-02T07:20:00.0000000Z",
"language": "es"
}
This information seems that it's not returned by API and there's no parameter to add this information in responses right now, tested on API v7.0.

Facebook API not working sometime for some URL

I'm getting number of shares and comment of blog posts using facebook graph api for my blog, but sometimes it do not return shares and comment.
Following URL is not giving number of share and comments.
http://graph.facebook.com/?id=http://www.lehedonist.com/jeans-is-the-new-whiskey-2001
BUT it is working for this URL:
Example: http://graph.facebook.com/?id=http://www.lehedonist.com/spring-slam-fashion-war-ss16-1965
I somehow wonder why it's even working to request these URLs without an access token to be honest.
See
https://developers.facebook.com/docs/graph-api/reference/v2.5/url
It only gives a result if there no version info in the URL. To do this in the v2.5 way properly, you'd have to use
https://graph.facebook.com/v2.5/?access_token={access_token}&fields=id,og_object,share&id=http://www.lehedonist.com/spring-slam-fashion-war-ss16-1965
where {access_token} is an actual access token.
Results will look like
{
"id": "http://www.lehedonist.com/spring-slam-fashion-war-ss16-1965",
"og_object": {
"id": "987675524635070",
"description": "Not your usual fashion post, we decode styles best suited to your personality and what should you be sporting next summer",
"title": "Spring Summer 16 fashion: The clash of fashion personalities",
"type": "article",
"updated_time": "2015-10-08T11:24:32+0000",
"url": "http://www.lehedonist.com/spring-slam-fashion-war-ss16-1965"
},
"share": {
"comment_count": 2,
"share_count": 81
}
}

How to get total number of tracks in a playlist using soundcloud json API

I am trying to paginate the track list of a set/playlist obtained via soundcloud JSON API. Pagination technique described here works fine if I want to generate tracklist of x number of tracks for next page only. What I am trying to do is to make a numbered pagination with multiple page links. I didn't find any parameter such as "track_count" which returns the total number of tracks for "/user/tracks". So, can anyone give me any insights on making a numbered pagination for a playlist when getting data via soundcloud JSON API? thanks
/users endpoint has "track_count" property in the returned representation of user:
$ curl "http://api.soundcloud.com/users/3207.json?client_id=YOUR_CLIENT_ID"
{
"id": 3207,
"permalink": "jwagener",
"username": "Johannes Wagener",
"uri": "http://api.soundcloud.com/users/3207",
"permalink_url": "http://soundcloud.com/jwagener",
"avatar_url": "http://i1.sndcdn.com/avatars-000001552142-pbw8yd-large.jpg?142a848",
"country": "Germany",
"full_name": "Johannes Wagener",
"city": "Berlin",
"description": "<b>Hacker at SoundCloud</b>\r\n\r\nSome of my recent Hacks:\r\n\r\nsoundiverse.com \r\nbrowse recordings with the FiRe app by artwork\r\n\r\ntopbillin.com \r\nfind people to follow on SoundCloud\r\n\r\nchatter.fm \r\nget your account hooked up with a voicebox\r\n\r\nrecbutton.com \r\nrecord straight to your soundcloud account",
"discogs_name": null,
"myspace_name": null,
"website": "http://johannes.wagener.cc",
"website_title": "johannes.wagener.cc",
"online": true,
"track_count": 12,
"playlist_count": 1,
"followers_count": 417,
"followings_count": 174,
"public_favorites_count": 26
}
This question is already old, but I hope this could help other people.
You could use either of this endpoint:
http://api.soundcloud.com/playlists/{playlist_id}?client_id={client_id}
https://api.soundcloud.com/playlists/{playlist_id}?oauth_token={oauth_token}
The 2nd API is undocumented, the first endpoint suddenly started to return 401 for no reason which is from the SoundCloud API documentation. I still provided the 1st endpoint as it's only not working at work, but behaves correctly at home IP address. I suggest if you'd use the 2nd API to generate and use a non-expiring token.
SoundCloud is not a reliable provider anymore as there's no app support for developers. You just have to figure things out by yourself.
On the JSON response, look for track_count. That'll give you the number of tracks in a playlist.

Facebook Graph API retrieving friends' images

I'm trying to get all the ids of all my friends along with their profile image. I'm using https://graph.facebook.com/me/friends?fields=picture&access_token=[myToken]
I'm getting this returned:
{
"data": [
{
"id": "xxx",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/xxx_q.jpg"
}
The picture url that returns is for a really small image. How can I get a larger image?
Recommended
According to Doc (section "Pictures"), url of profile's photos can be built with the user id
For example, assuming user id is in $id :
"http://graph.facebook.com/$id/picture?type=square"
"http://graph.facebook.com/$id/picture?type=small"
"http://graph.facebook.com/$id/picture?type=normal"
"http://graph.facebook.com/$id/picture?type=large"
Hack
http://profile.ak.fbcdn.net/hprofile-ak-snc4/xxx_q.jpg
You can replace the q parameter with s or b
:)

How do I get the permalink of a specific Facebook Social Plugin Comment through the Graph API?

Consider the following piece of dummy data returned from the Graph API for Facebook's Commenting Social Plugin:
{
"id": "387539086359_14842802",
"from": {
"name": "Manja Elis",
"id": "1168990251"
},
"message": "http://www.facebook.com/pages/Manja-Elis/151029671610040",
"created_time": "2010-11-24T07:06:06+0000",
"comments": {
"data": [
{
"id": "494442921359",
"from": {
"name": "J Reigy T II",
"id": "100001234540335"
},
"message": "~ www.jareta.name ~",
"created_time": "2011-01-30T00:04:30+0000"
}
],
"count": 1
}
}
How can I generate the permalink to this specific comment so that it can be bumped to the top of the discussion?
I know that the first id# "387539086359_14842802" is the ID of the comment thread as a whole, but now I need the specific ID of the actual first comment so that I can properly link to it. The problem is, that 3rd piece of ID information is nowhere to be found.
What I find funny is that the reply comment with id# "494442921359" is the correct ID for that reply, but there is no equivalent offered for the original post - why??? Worse yet, Facebook ignores links to any comments that aren't the first in a new sub-thread so linking to the reply instead is useless to me.
So to clarify:
Comment id of first post in the thread is : 387539086359_14842802_????
Comment id of the reply to this post would be: 387539086359_14842802_494442921359 but unfortunately FB ignores reply IDs so it is useless to me.
Can anyone tell me how I programatically get this ???? ID for permalink generation purposes?