How to get Facebook Page ID from Page URL - facebook-graph-api

I need to get the Page ID from the Page URL. This is NOT from inside a page tab, that's easy. This is similar to what is being done here: http://findmyfbid.com
Any help would be appreciated as I have been searching for over an hour! Bonus points for showing how to do this in classic ASP. I have no issue getting signed requests & parsing them, the URL to ID portion is what is throwing me.
thanks :)

As noted above in 1st answer commments, that does work, but it's not the data that we want since it's an external url. THIS is the correct way to do it:
https://graph.facebook.com/v2.5/cocacola?access_token=[yourtoken]
OR
This works too:
https://graph.facebook.com/v2.5/https://www.facebook.com/cocacola?access_token=[yourtoken]

This is the way to do it: https://developers.facebook.com/docs/graph-api/reference/v2.0/url
if you are using a GET request, be sure to append access_token=appid|appsecret to the URL you are requesting and it will work.
Thanks for the tip to point me in the correct direction Alex!

Related

How to exclude retweets and replies from Twitter API Full-archive search

I am trying to extract some historical tweets using twitter API. And I want to exclude retweets and replies. I tried other suggested answers here but nothing seem to work. Can someone please help me, I am struggling since a week to find the resources. Below is my endpoint for Full-archive search.
https://api.twitter.com/2/tweets/search/all?query=MMIW OR MMIP OR MMIWG&start_time=2015-01-01T00:00:01Z&end_time=2015-01-15T23:59:01Z&max_results=500&tweet.fields=created_at,entities,geo,id,referenced_tweets,in_reply_to_user_id,lang,possibly_sensitive,source,text,withheld&place.fields=country,full_name&user.fields=created_at,description,location,name,pinned_tweet_id,username,verified,withheld
Okay, so I figured out from twitter's rules and filtering operators from the link below:
https://developer.twitter.com/en/docs/twitter-api/enterprise/rules-and-filtering/operators-by-product
i just had to add and negate the is:retweet operaor in my query field.
Ex: query=(MMIW OR MMIP OR MMIWG) -is:retweet
So, my modified endpoint that worked:
https://api.twitter.com/2/tweets/search/all?start_time=2015-01-01T00:00:01Z&end_time=2015-01-15T23:59:59Z&max_results=500&tweet.fields=created_at,entities,geo,id,lang,possibly_sensitive,source,text,withheld,in_reply_to_user_id,referenced_tweets&place.fields=country,country_code,full_name,geo,id,name&query=(MMIW OR MMIP OR MMIWG) -is:retweet&user.fields=created_at,description,location,name,pinned_tweet_id,username,verified

Get page insights and post insights in the same request

Hello i am trying to get page level insights and post level insights in the same request but cant seem to get the syntax correct.
page id /published_posts?fields=permalink_url,created_time,message,shares,reactions.limit(0).summary(1),comments.limit(0).summary(1),insights.metric(post_reactions_by_type_total,post_impressions_unique,page_posts_impressions_organic)&since=yesterday
This is my request for now but i wanna add page insights like page_fans and page_fans_city.
How can i do that?
You are using the published_posts endpoint there already, you can not go back “up” to the page object from there. You need to rewrite the whole thing so that you use the page id itself as the basic endpoint, and then request everything else via the fields parameter. The trick is to get the syntax and nesting right …
/page-id?fields=insights.metric(page_fans,page_fans_city),published_posts{…}
should work, inside the {…} you then put all the original fields you requested from the published_posts endpoint before, so
/page-id?fields=insights.metric(page_fans,page_fans_city),published_posts{permalink_url,
created_time,…,insights.metric(post_reactions_by_type_total,post_impressions_unique,
page_posts_impressions_organic)}
And &since=yesterday then just goes at the end again, after all that.
To have the since limitation still apply on the post level, it apparently needs to be added on that “field” again, syntax similar to .metric():
?fields=…,published_posts.since(yesterday){…}

Cant get HTTP Post result of Website

Sorry for my bad english.
I am working on a Teamspeak plugin.
I am trying to get the website content, where I posted some Parameters.
The Website is http://ts3.cloud/ts3proxy and the Parameters which I found with a sniffer are "Input" and "port".
When I call http://ts3.cloud/ts3proxy?input=testserver.de&port=9987 the results not same as when I go to Website, type in Manual and use the Buttom.
Can someone say why it is like this? What should I do that I get the right result?
Xploid.

Django current location bar

I would like to "current location bar" id Django. Something like on eBay under the "Women clothing" (eBay>Fashion>Women's Clothing), but I don't really know how to do it.
I was wondering if I should use request.get_full_path() or something like that, but it seems very dirty to me.
Thanks in advance,
Adam
What you're looking for is called "breadcrumbs" and you can find a nice snippet here
As said there:
The URL
/users/foo/config/
will get to these breadcrumbs:
Users>>foo>>Config
which is basically the correct way to understand this snippet!
Hope it helps
you're wanting the full breadcrumb trail?
Usually you just use django's url template tag: https://docs.djangoproject.com/en/1.3/ref/templates/builtins/#url and reverse each known url for where you are on the site.

How can I retrieve all comments on a Facebook post using the php SDK?

I'm building an app which allows users to post articles to their facebook wall. When an article is posted, I retrieve the post id and store that in the database along with the rest of the article details. Now I want to be able to show the comments made on that post when someone views the article in my site; I would also like to allow users to add comments to the post from my site.
I know that the user is always logged into Facebook when they are viewing the article, as the system checks for that earlier on.
I've been using the PHP SDK, and thought all I had to do was something like:
$post_comments = $facebook->api('/' . $post_id . '/comments');
However, when I do this, I get the following error:
Fatal error: Uncaught GraphMethodException: Unsupported get request. thrown in /APP_PATH/facebook/src/facebook.php on line 560
I really don't have much of a clue what I'm doing here, to be honest, as I'm very new to the Facebook Graph API, and I can't seem to find a lot of documentation on it.
Can anyone tell me what I should be doing here, or point me to some documentation I could read about it?
Thanks!
It should work.
Here is the code I am using which is working for me.
$comments = $facebook->api($postid . '/comments');
Make sure your postid is a valid one.
Alternatively, you can directly type that url in browser to get details like this
https://graph.facebook.com/<postedid>/comments
Please refer this link for further reference
http://developers.facebook.com/docs/reference/api/Comment/
I don't know what your PHP library is doing, but you can actually access comments by reading graph.facebook.com/<post_id>/comments. Indeed, try with this one from the doc.
Are your sure of your post id? Try to call the buggy function with 19292868552_118464504835613 as post id. It has to work.