Get facebook fans count using API 2.8 - facebook

How to get Facebook fans count using http request in API 2.8
-- I test these requests but not working
This return an array but no Fans Count
https://graph.facebook.com/v2.8/{APP_ID}?access_token={ACCESS_TOKEN}&edges=fan_count
Return
{
"category": "Entertainment",
"link": {APP LINK},
"name": {NAME},
"id": {ID}
}
-- This throw an error array
https://graph.facebook.com/v2.8/{APP_ID}?access_token={ACCESS_TOKEN}&fields=likes
Return
{
"error": {
"message": "(#100) Tried accessing nonexisting field (likes) on node type (Application)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "FlkGoTOJ403"
}
}

This is the correct one:
https://graph.facebook.com/v2.8/{PAGE_ID}?access_token={ACCESS_TOKEN}&fields=fan_count
Not sure why you would use an App for this, Fans are for Pages.

Use {PAGE_NAME} instead of {APP_ID}
GET ACCESS TOKEN: https://graph.facebook.com/oauth/access_token?client_id={APP_ID}&client_secret={APP_SECRET_KEY}&grant_type=client_credentials
GET FANS COUNT: https://graph.facebook.com/v2.8/{PAGE_NAME}?access_token={ACCESS_TOKEN}&fields=fan_count
Thanks for luschn

Related

PSID is unsupported GET request Graph API?

I'm trying to get labels associated with participants of conversations on my fb page.
My GET request: <pageID>/conversations?fields=participants,id&access_token=<PageAccessToken>
The POST:
{
"participants": {
"data": [
{
"name": "Jim Bean",
"email": "numbers#facebook.com",
"id": "2821512231253160"
},
{
<my page info>
]
},
"id": "<convo link>"
},
When I click on the participant's ID, I get the following error.
"message": "Unsupported get request. Object with ID '2821512231253160' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph...",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "AwlTn9Vx3mfPtRGnquaHm8k"
Thus, I cannot request labels associated with PSIDs without being able to get info on my user's PSIDs.
What am I missing? How can I retrieve PSIDs from conversations?

How to get all counts of likes of post of our page? #LinkedIn

How to get all counts of likes of post of our page, Actually we have created a Page and posted some articles. Now I want to retrieve all likes of my post using APIs, I can get the access token from Postman.
When i am run the V2 API to get data thru poastman, i got the following error:
"Not enough permissions to access: GET /socialActions/".
Please advise what more permission required.
Get the Access Token from postman for OAuth2.0 under Auth navigation of postman. After getting the access token, run the https://api.linkedin.com/v2/socialActions/{activity}
I am getting following error
{
"serviceErrorCode": 65604,
"message": "Empty oauth2 access token",
"status": 401
}
I used in other system Postman then found following error:
{
"serviceErrorCode": ,
"message": "Not enough permissions to access: GET /socialActions/",
"status": 401
}
Should be come the result data in JSON format
You can also use this request https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/share-statistics#sample-request
Following is sample request
https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:xxxxxx&shares=urn:li:share:xxxxxxxxx&count=1000
Sample Response :
{
"elements": [
{
"totalShareStatistics": {
"shareCount": 2,
"clickCount": 1,
"engagement": 10,
"likeCount": 5,
"impressionCount": 7,
"commentCount": 5
},
"share": "urn:li:share:xxxxxx",
"organizationalEntity": "urn:li:organization:xxxxx"
}
],
"paging": {
"count": 1000,
"start": 0,
"links": []
}
}

How to delete a facebook marketing lead form using graph api

According to the facebook documentation here Deleting a Lead Form
this is how you do it:
Send a delete http request to https://graph.facebook.com/v2.10/formId?access_token=the_access_token.
However I get the error below when I try the above:
{
"error": {
"message": "(#210) This call requires a Page access token.",
"type": "OAuthException",
"code": 210,
"fbtrace_id": "ABC123/xyz"
}
}
When I use a Page access token (as suggest by the error response) this is what I get:
{
"error": {
"message": "(#3) Subject must be on whitelist",
"type": "OAuthException",
"code": 3,
"fbtrace_id": "IJK123/uvw"
}
}
If it matters the accessToken initially used is the same token used to create the leadform.
How can I get this to work? What am I missing?

Facebook API: Post likes edge has no total_count field

My query on the Facebook graph explorer is ..../175126819173613_796398493713106/likes?fields=total_count
Where the long number is a post id. For some reason, the post/likes edge only has a data field and the above query fails with:
{
"error": {
"message": "(#100) Unknown fields: total_count.",
"type": "OAuthException",
"code": 100
}
}
The reference says that each like edge should have a total_counts field so I'm not sure what I'm missing.
Old question but,
175126819173613_796398493713106/likes?summary=1&limit=0
gives
{
"data": [],
"summary": {
"total_count": 2
}
}

how to get facebook post after a graph search?

https://graph.facebook.com/search?access_token=xxxxxx&q=hello&type=post&fields=from,message,picture,link,name,caption,description,created_time&limit=1&locale=en_US&scope=publish_stream,offline_access,user_status,read_stream
After such a graph search, I get some data like:
{
"data": [
{
"from": {
"name": "Eric Fluegge",
"id": "100000626293694"
},
"message": "Well, here's go nothing. Hello Tennessee.",
"created_time": "2013-03-30T19:23:44+0000",
"id": "100000626293694_567340783296793"
}
],
"paging": {
"previous": "https://graph.facebook.com/search?fields=from,message,picture,link,name,caption,description,created_time&q=hello&limit=1&type=post&locale=en_US&access_token=XXXXXXXXXXXXX&since=1364671424&__previous=1",
"next": "https://graph.facebook.com/search?fields=from,message,picture,link,name,caption,description,created_time&q=hello&limit=1&type=post&locale=en_US&access_token=XXXXXXXXXXXXX&until=1364671423"
}
}
so, is "id": "100000626293694_567340783296793" a post id? If so, how to use this post id, query again, get only this certain post information? I would like to store post id to mysql table, then I want to query the post anytime in the future, thanks.
EIDT: in app setting, i have set the publish_stream,offline_access,user_status,read_stream
EIDT2:
I have tried into Graph API Explorer, choose read_stream and generate a long live token.
SELECT post_id, actor_id, message, type, attachment FROM stream WHERE post_id = "100000626293694_567340783296793"
the result still empty. so I cannot get a post bcause i am not a friend of the post auther? or 100000626293694_567340783296793 is not a post id? or other reason?
Yep, the "id": "100000626293694_567340783296793" is a post ID, you can query its data again with the following URL: http://graph.facebook.com/100000626293694_567340783296793
Attention!
You should ask for the read_stream permission/scope too! Or else you'll get the following error:
{
"error": {
"message": "Unsupported get request.",
"type": "GraphMethodException",
"code": 100
}
}
And of course, append the access_token to your GET url. (and don't forget https too)
You can check the Graph API Reference here: Post - Facebook Developer Reference