Where is Save Session button in the Graph API explorer - facebook

I am trying to submit bugs about the graph API to facebook and they have a field for "Graph API Explorer Repro URL" The instructions are as follows:
Please provide a repro instance URL that describes the bug:
Get an access token by clicking on the "Get Access Token" button. Select permissions and select "Get Access Token".
Create your Graph API or FQL query that reproduces the issue. Test your query by clicking on the "Submit" button.
Click "Save Session" button to save your repro instance.
Copy paste the URL into the "Graph API Explorer Repro URL" field on the bug creation dialog. For example: https://developers.facebook.com/tools/explorer/145634995501895/?session_id=411486588960534
However, I don't see a Save Session button. Here's my screenshot: http://screencast.com/t/fWqPitPU
Am I missing it or do I need to do something in my permissions to allow for the save session button to show?

Save session button is available towards Down-Right corner of the Facebook Graph API Explorer page. Once, you have saved the session, you can copy the URL and submit it with the bug report.

Related

Facebook Explorer page showing BLANK page

When I try to visit this url https://developers.facebook.com/tools/explorer/145634995501895/
Its shows complete blank page.
I tried with different browser. I tried with different internet connection. I trie on PC and phone.
All Same
What could be the reason? Am I blocked from using the explorer?
Try this link
Press the button "Get Accces Token", "Get Access Token" again in the pop-up window (you don't need special permissions there) and then "Submit" button.

Facebook (#100) App is not installed, when trying to remove a Page Tab Application

I get a "message: "(#100) App is not installed:" when i try to delete a pagetab application from a specific page using graph api.
Here are the steps to reporduce the problem.
Visit graph api explorer at https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=me%3Ffields%3Did%2Cname&version=v2.0
Get an access token with manage pages permission and request me/accounts using GET method.
You will see list of pages you are admin / owner of. Copy an access token from the page you wish to delete a tab. And paste that access token at the top under the access token field.
Now click the id of the the page (from where u have copied the access token) and you will see page data as a result of api/2.0/pageId GET method. This data contains all the infomration of page tabs. If it works till this part. You can just add /tabs a the end of the above command to see the information of tabs. i.e. API/2.0/{PAGE_ID}/tabs
Now you will see a list of page tabs, click on the id of one of tabs that is added by you(Not the fixed ones like photos and like tab). The id should be in the form of API/2.0/{PAGE_ID}/tabs/app_{APP_ID}. And choose the DELETE method from the dropdown.
Now click the submit button and you will get Error 100.
I have spent quite much of the time in resolving this but its not working at all for me. Please try the above procedure and help me knowing if I am doing something wrong or is it a facebook bug. I did all the above steps according to the inromation provided under facebook documentation.
https://developers.facebook.com/docs/graph-api/reference/v2.0/page/tabs

Perl Facebook::Graph Post to Facebook Page as Page, not as Admin

Using the Perl module, Facebook::Graph, I have created some basic perl code that can post to my own wall. I can share a photo on my own wall. I can also post a simple wall message to one of the pages for which I am an admin. However, when I try to post a photo to the page, it posts as me, not as the page.
Here is the sample code that posts as me, to the Facebook page. I need it to post as the Page, not as me.
# previously, I obtained my Page's accesstoken, and other credentials
# including the Facebook Page ID
my $fb = Facebook::Graph->new(
app_id => $facebook_application_id,
secret => $facebook_application_secret
);
$fb->access_token($facebook_accesstoken);
my $rstring = $fb
->add_photo
->to($facebookPageID)
->set_message('Look at this really cool photo!')
->set_source('./raw_image_example.jpg')
->publish
->as_string;
print "$rstring\n\n";
I am trying to figure out how to create a post to the wall of a Facebook page, as if it is being posted BY the page, not by me.
I am trying to do that with the CPAN module, Facebook::Graph, located here: http://metacpan.org/pod/Facebook::Graph
I cannot, for the life of me, figure this out. Any help would be most welcomed!
I went through the same trouble, so let me share what I did step by step so it might benefit other people:
After going to developers.facebook.com to create an app, you
go to https://developers.facebook.com/tools/explorer/
There, on the top menu named "Graph API Explorer" you select the app
you just created
Then, on the righthand side, there is another menu named "Get
Token", in which you select "Get Access Token", then a pop-up window
will appear, you to the extended
permissions tab, and check "publish_pages" and "manage_pages"
options and click on "Get Access Token". It will pop-up a window
asking you to confirm you want to grant access to this app. It will
produce a long token.
Then, you select the menu Get Token again, and you will find in this
menu the list of the pages you manage, select the one you want and
it will show its related access token.
Now the token received is only temporary like 2 hours or something.
You want something that last 60 days and renewable, so from your
server you do a curl request:
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id=$facebook_application_id&client_secret=$facebook_application_secret&fb_exchange_token=$facebook_accesstoken
Facebook will output something like this:
access_token=ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ&expires=5184971
Then, you can post as your page using your fine code.
I hope this helps.
Enable manage_pages permission to get a code.
Submit code to get user access token for your account (you are manager or content_creactor) for query everythings.
Queried your account by calling /me/accounts, you will get page access token. one account can manage many pages. So use JSON to choose which one do you want.
Use those page access token to post msg or photo as normal. https://graph.facebook.com/me/feed
(note that it is not /feed) since page access token contain the ID already.

Get all photos of a page using Facebook API

I am new to Facebook API but I have to get all photos from a Facebook page. I managed to get a graph api query that returns all pictures of only the first ever created album on the page which is the profile picture album. For example:
https://graph.facebook.com/227843870675663/photos
But I need to do the same for all other existing albums in the page. Any pointers are really appreciated.
Try this and let me know how it goes for you. I've successfully pulled all photos from a Facebook page.
Ensure that you are an Admin of the Facebook Page.
Go to:
http://developers.facebook.com/tools/explorer
In the API Navigator, you can access /me to bring up the basic information of yourself.
Try typing in /me/accounts to see if you can see anything. It should give you an error.
You need to enable certain permissions to make this Graph query. Choose the relevant permissions in the right sidebar. According to this doc you need the pages_show_list and pages_read_engagement permissions for this query.
Click on "Get Access Token" which will give you a new token with the updated permissions. You may get a popup window where you have to confirm which page(s) you would like this access token to be able to see.
Now try /me/accounts again. You should see a list of pages that you enabled access for, inside the viewing window.
Find the Facebook Page you want to query, and click on the "id" field. This ID is needed for making any queries related to this page.
Next, on the left window, you can see "Node: " and a + sign. Click on the + sign to see what options you have.
Click on the + sign and scroll down to "connections" and select "Albums"
The child-level, select "Photos"
The "Photos" child-level, select "source"
Now click "Submit" on the right hand side.
If the above doesn't work, you can try copying the following URL into the API explorer:
YOUR_PAGE_ID/?fields=albums.fields(photos.fields(source))
You will see a JSON returned with the URL of some/all of the photos in your selected Facebook Page.
Click "Get Code" and it will show you the Javascript or raw URL used to access this information.
The "cURL" tab will show the URL which will look something like this:
https://graph.facebook.com/v15.0/YOUR_PAGE_ID?fields=albums.fields(photos.fields(source))&access_token=YOUR_ACCESS_TOKEN_HERE
You can copy that URL and plug it into your browser. You should see a JSON of all your photos, and each photo's corresponding URL on Facebook's CDN.
Getting photos posted to the feed, not just photo albums
To do that, you need to run a slightly different query:
https://graph.facebook.com/v15.0/YOUR_PAGE_ID/feed?fields=attachments
Getting high resolution imagery
Many of the image URLs provided by the queries above will only provide resolutions up to 720px. If you want higher resolution images, then you need to find the target.id for each subattachment, and perform a separate graph query for each image to obtain the other resolutions. It looks like this:
https://graph.facebook.com/v15.0/YOUR_IMAGE_ID?fields=images
Watch out for expiring tokens
The token generated above will only work for approximately 1-2 hours. If you want a longer lasting token, follow the steps in this post here.
When you get your Facebook user, you can:
get the list of all its
albums
get the user's profile
picture
get the
photos
the user (or friend) is tagged in
They respectively need those permissions:
user_photos or friends_photos
not needed
user_photos or friends_photos
UPDATE:
If you want to get those information from a Facebook page:
Photos - The Page's uploaded photos.
Albums -
The photo albums the Page has uploaded.
Permissions are: any valid access_token or user access_token

How to post to a page using FB.ui()?

I am trying to replicate the "share" functionality provided by the "share" link under a wall post: The dialog shows a dropdown box at the top allowing me to choose whether to post to my timeline, in a group, the wall of a page I manage (etc).
Ideally I'd like to able to do this without having to get extended permissions from the user. So I tried FB.ui() but could only get "Post to your wall" to post to the user's timeline. It doesn't have the same dropdown box at the top.
Accordiong to the doc I should be able to provide a page id as the "from" parameter to enable users to use the dialog to post to a page (assuming they are admins of the page). So I tried this but I always get the same "Post to your wall" dialog (even tho I'm admin of the page given).
The doc page contains a link How can I use the Feed Dialog to post on a Facebook Fan Page wall not liked by the user? but it's a dead link :-[
So can it be done using the dialog? Or do I have to get "manage_pages" permission and post to /pageId/feed (as here)?
Thanks!
Well it seems today I can do it using the feed dialog after all. I tried apage based on the example in the doc added my page id as the "from" parameter and it works.
I need to be logged on as a page admin, but I don't need to be "using Facebook as" the page.