How can I get list of facebook likes (pages that user has liked ) with descriptions
Im using /me/likes object, but it won't give me likes descriptions. I understand I can use FQL with "WHERE page_id in (LIST_OF_IDS)" - or request for every like separately
Is there any way to get it with one request ?
Yes, this can be done via FQL with the following query:
SELECT name, description FROM page WHERE page_id IN (SELECT page_id
FROM page_fan WHERE uid=me())
https://developers.facebook.com/tools/explorer?fql=SELECT%20name%2C%20description%20FROM%20page%20WHERE%20page_id%20IN%20(SELECT%20page_id%20FROM%20page_fan%20WHERE%20uid%3Dme())%0A
Or this way using the Graph API: USER_ID?fields=likes.fields(description)
If it is possible with the Graph API, don´t take FQL. The Graph API is usually faster and easier:
me/likes?fields=id,name,description
Result (from my account):
"data": [
{
"id": "244993732224805",
"name": "Jón Gnarr",
"created_time": "2012-12-06T00:35:43+0000"
},
{
"id": "161086703983",
"name": "Design Shack",
"description": "We only offer the cream of great design, filtering through lots of the redesigns that occur every day across the Internet, and cataloguing the greatest projects out there - perfect for getting that spark of creativity going again.\n\t\nRegular articles will teach you new techniques for creating your own designs, and daily community news ensures that you're up to date with the latest developments elsewhere.\n\t\nIf you want to be updated every time a new design or tutorial is added, you can subscribe:\n\t\nDesign Shack RSS Feed\nhttp://feeds.feedburner.com/designshack\n\nTwitter\nhttp://twitter.com/designshack",
"created_time": "2012-12-04T14:40:08+0000"
},
{
"id": "274797542535942",
"name": "Chasing Aurora",
"description": "Chasing Aurora is an explorative 2D aerial action game about the dream of flight.\n\nDrop from the cliff and ride the wind from peak to peak. Fight for the beacon of light with up to three friends in the hostile environment of the Alps.",
"created_time": "2012-12-04T12:07:13+0000"
},
...
Related
I am extracting Ad Insights. I am using Facebook Marketing API.
I want to extract Spend & Offsite Conversions.
So following are the details:
fields: account_id, account_name, campaign_id, campaign_name, adset_id, adset_name, spend, actions
Breakdowns: hourly_stats_aggregated_by_audience_time_zone
actions_breakdown: action_type
Does anyone knows how facebook returns data? I mean how the data is returned by audience time zone at hourly basis by using above breakdown. You can refer to following sample response.
{
"data": [
{
"impressions": "1148",
"date_start": "2016-03-05",
"date_stop": "2016-04-01",
"hourly_stats_aggregated_by_audience_time_zone": "00:00:00 - 00:59:59"
},
{
"impressions": "172",
"date_start": "2016-03-05",
"date_stop": "2016-04-01",
"hourly_stats_aggregated_by_audience_time_zone": "01:00:00 - 01:59:59"
}],
"paging": {
"cursors": {
"before": "MAZDZD",
"after": "MjMZD"
}
}
}
If my ad is targeted in multiple regions(diff timezones) then how the data will be returned?
I don't have any timezone information to know which local timezone this data is aggregated.
Any help would be appreciated. Let me know my assumption about any term related to Facebook Marketing is incorrect.
The response format, as CBroe pointed out, is https://developers.facebook.com/docs/marketing-api/insights/breakdowns/v2.9#hourlybreakdowns
The data aggregation is based on audience's local time. If people are in different timezones, they all use their own local time for aggregation. (i.e. This can used to learn whether your ads are more effective during morning time or evening time.)
I'm trying to search and retrieve news articles on Alchemy Data News. I can get results using entities:
https://access.alchemyapi.com/calls/data/GetNews?apikey=[redacted]&outputMode=json&start=now-60d&end=now-0d&maxResults=10&return=enriched.url.title,enriched.url.url,enriched.url.entities,enriched.url.concepts&q.enriched.url.entities.entity=|text=Neil%20Tyson,type=Person|
and I can get results using keywords:
https://access.alchemyapi.com/calls/data/GetNews?apikey=[redacted]&outputMode=json&start=now-60d&end=now-0d&maxResults=10&return=enriched.url.title,enriched.url.url,enriched.url.entities,enriched.url.concepts&q.enriched.url.enrichedTitle.keywords.keyword.text=solar%20System
but if I combine the two I just get results that say "OK":
https://access.alchemyapi.com/calls/data/GetNews?apikey=[redacted]&outputMode=json&start=now-60d&end=now-0d&maxResults=10&return=enriched.url.title,enriched.url.url,enriched.url.entities,enriched.url.concepts&q.enriched.url.enrichedTitle.keywords.keyword.text=solar%20System&q.enriched.url.entities.entity=|text=Neil%20Tyson,type=Person|
{
"status": "OK",
"usage": "By accessing AlchemyAPI or using information generated by AlchemyAPI, you are agreeing to be bound by the AlchemyAPI Terms of Use: http://www.alchemyapi.com/company/terms.html",
"totalTransactions": "4320",
"result": {
"status": "OK"
}
with no docs. Is this supposed to work, or am I barking up the wrong tree?
The problem is you've created a query with 0 results. If you remove the &return portion of the query the response will include only a count. You can also add &timeSlice to see results by time bucket (more on counts and time slice here). Running your combined query with a monthly time slice (&timeSlice=1M) returns:
"status": "OK",
"totalTransactions": "4322",
"result": {
"count": 0,
"slices": [
0,
0
],
"status": "OK"
}
An example of the combining entity and and concept with many recent/topical response (at least during Feb 2016) is replaceing Solar System with B.o.B:
https://access.alchemyapi.com/calls/data/GetNews?outputMode=json&start=now-60d&end=now-0d&maxResults=10&return=enriched.url.title&enriched.url.url&enriched.url.entities&enriched.url.concepts&q.enriched.url.entities.entity.text=Neil+Tyson&type=Person&q.enriched.url.enrichedTitle.keywords.keyword.text=B.o.B&apikey=<YOUR API KEY>
and that's where the focus of this service is, querying and helping identify trends in recent news.
I'm using facebook graph API in my Unity Application. What I'm trying to do is to retrieve the users using my application and show the first 20 ones ordered by score.
In the example project "friend smash" there's the following graph API call:
FB.API("/app/scores?fields=score,user.limit(20)", Facebook.HttpMethod.GET, ScoresCallback);
This, as far as I know, gets 20 users who are using my application. Due to the poor graph API documentation I can't understand if user.limit(20) just returns 20 random users, or ordered with some criteria.
If this call returns random users, do I have to send one query for each friend, sort them by score and show only the first 20 ones to get a proper ranking? (I guess it would be quite query heavy though)
In Facebook Graph Explorer use following GET request to receive friends with score (descending order):
app/scores?fields=score&limit=20
It should return following Json:
{
"data":
[
{
"score": 1,
"user":
{
"name": "1st Name",
"id": "first_id"
}
},
{
"score": 0,
"user":
{
"name": "2nd Name",
"id": "2nd_id"
}
}
]
}
https://developers.facebook.com/docs/games/scores/#read-many-scores:
You can read the set of scores for a player and their friends by issuing an HTTP GET request to /APP_ID/scores with the user access_token for that app. The user_friends permission is required in order to view friends' scores. This returns a list of scores for a player and friends who have authorized the app. The list is sorted by descending score value, so it returns friends with the highest scores first.
(Highlighting by me.)
I need to get the shares count of a particular post in fb uisng graph api.
I could'nt find any method to do so. I have followed the link below.
https://developers.facebook.com/docs/graph-api/reference/v2.3/object/sharedposts
It returns the data of the shared posts in pagination format.
Is there any way to get the total count of the shares without fetching the whole data and without paginating within the data?
Please suggest!!
Just the field shares should give you the number of shares for a POST_ID
[POST_ID]?fields=shares
Sample data from my feed
{
"shares": {
"count": 1
},
"id": "POST_ID",
"created_time": "2015-04-29T09:07:12+0000"
}
Get shares count :
114916098537132_1265715836790480?fields=shares
Bonus [ Get likes + shares + comments ]
114916098537132_1265715836790480?fields=shares,likes.summary(true),comments.summary(true)
Improved version ( add limit(0) to removes list of likes and get only summary ):
114916098537132_1265715836790480?fields=shares,likes.limit(0).summary(true),comments.limit(0).summary(true)
I'm trying to get Facebook user information by username. I'm trying to make following FQL request:
SELECT first_name, last_name FROM user WHERE username="Google"
I got no data in response:
{
"data": [
]
}
Same query works OK for other usernames:
SELECT first_name, last_name FROM user WHERE username="c1egger"
This gives me:
{
"data": [
{
"first_name": "Paul",
"last_name": "Dmitryev"
}
]
}
I've tried to use GrapAPI with following request:
/Google?fields=id,name
And got the result:
{
"name": "Google",
"id": "104958162837"
}
Also, I'm getting same problem, when trying to query by userid.
Major part of my application uses FQL, so I'd like to figure out why FQL not working, before starting complex porting to FQL.
They are not the same request...
/Google?fields=id,name
That request doesn't check in "User" table, that's why you can't retrieve user "google" with '104958162837' id.
facebook.com/c1egger and facebook.com/Google are not the same type of page.
select name from page where page_id=104958162837
or
select page_id from page where username='Google'
Gives you the same result as the graph api.
FQL works, but it's more complex that GraphApi to use.
Facebook Query Language, or FQL, enables you to use a SQL-style interface to query the data exposed by the Graph API. It provides advanced features not available in the Graph API.