How to get Facebook post id when uploading? - facebook

I have created a custom desktop app (Adobe AIR) that allows users to upload videos and pictures to their wall. As it turns out, I have to have control of these posts that get created by my app. I've read that everything you post using graph api has a post id:
http://developers.facebook.com/docs/reference/api/post/
I would like to know how can I retrieve this id so I can keep track of certain statistics later with FQL. Does anyone know how this is done?

While creating a post or uploading a photo to Facebook, the id of the newly created object is returned by Facebook. What you need to do is to fetch the response of the POST request you sent.
This should help https://developers.facebook.com/blog/post/498/
If you know C#.Net coding i shall provide you sample code for implementing it.
Get back if you need more help.

When you press on the timestamp in the head of the post you'll get a page with the post only with it's link in the adress bar, there you can also see the post ID.
That was what I've been looking for, and found out by myself...
Hope it helped you too.

Related

Facebook Graph API pull a Posts basic data like Instagram Basic API

We are developing a mobile app that if share a FB post link to it, like you can share on WhatsApp, we want to be able to read the title or summary or start of that FB post, and redirect our App to the corresponding area.
So it works on Instagram using: https://developers.facebook.com/docs/instagram-basic-display-api/
Where give the post ID and it pulls in the caption text etc.
So works for IG and some other socials for anonymous users.
But for FB links, it mostly shows us the login page, in most cases (sometimes it worked on localhost maybe if logged-in - but could not recreate on server environments).
So cannot pull in any info about the post have shared using a direct FB share URL or maybe via some method on FB Graph Api, we could not see an easy way.
Does anyone know a generic method that anyone sharing a post to an app, or even just being able to see the title or summary of a FB post using the default share link, so we can direct our App to the right page.
So essentially using a FB post share link, we want to be able to read some basic data of that Post, whether logged in or not,
and happy to do this via Graph API or FB App or any other ways.
Again in summary - need to Get some user defined parameters or text or ideally hashtags from the post just using the share link of any FB Post/Page.
Any ideas or help appreciated.

Facebook Graph API insights

I'm new on working with Facebook and honestly I found it very confusing, terminology and documentation seems to be very ambiguous in many cases. Can somebody please help me out with a plain english explanation on how I can achive the following?
Post and image to Facebook (on the user page) and then check the stats (insights) of that post.
Till now I have managed to:
1) Create an app
2) Post the image on the user page with the desired message
I'm not able to understand how I can retrieve information about the particular image which was uploaded through my app. I want to know how many people have viewed that image, how many likes did it get, how many times it was re-shared.
Is it possible at all?
I'm posting to /photo not too /feed and I will like to keep it this way if it is possible.
Sorry if this was answered already but I spent a few hours trying to find an appropriate answer but wasn't able to get the right documentation.
UPDATE 1
After having a couple of days off from this topic and receiving the first 2 answers, I took another dive into this. Now I have tried the Graph API Explorer as suggested, and using the ID of a POST I can get some details about the POST, but the insights aren't showing anything, just next and previous.
My goal is to be able to gatther some stats about the pictures uploaded through the app. If this is not possible directly what should be the approach I need to take?
I don't believe a personal /photo has /insights attached to it - the Insights Object documentation page suggests that they do not - but you should be able to get likes, shares, and comments via the API.
It would appear FB has launched a redesign/reorganization of its documentation in the last couple of weeks, but the documentation for the /photo graph object is here -- you will need the user's Access Token, and the API endpoints you're looking for each have links to their own documentation pages there, including example code for each type of request.
Edit (summarizing discussion in comments):
There is no method via the Facebook API to gather insights for all photos posted to individual user timelines via an app. The app can gather likes, shares, and comments for each of those objects individually via API requests, and can make API requests for insights for photos posted to its own timeline. Neither of those options solves the intended use case here.
I'd recommend a solution that uses Sharing rather than an app integration, as this allows for better access to insights on the photos being shared. This is also a much simpler integration, and less brittle wrt future Platform changes. The main tradeoff is that the original photos being shared are expected to expire after a couple of months -- if this is unavoidable, I'd suggest implementing a redirect for requests for expired objects on the site.
We are able to get different kind of photos or picture Using Graph API
like as below:
1.Page Photos
Photos for a Facebook Page.A Page Access Token is required for all methods.Find here
2.Page Picture
Picture belonging to a Facebook Page. Find here
3.Photo
Represents an individual photo on Facebook. Find here
4.User Photos
Photos for a person.Find here
I hope it's helps you.

Is there a way to store the likes,share of facebook,google in database?

I am developing a site..in which we have pictures,video which users can share/like/tweet
them.
facebook , google and twitter
Can i save the clicks by getting response that post is shared successfully?
eg: someone liked/shared the video than i want to get a response from facebook that post is shared successfully.
also if some liked and then disliked it ..to save only unique likes
Is there any way to accomplish this?
I found something for fb share Is it possible to add a link to download a file that can only be downloaded by sharing it on Facebook?
Thanks
Perhaps not the best by-the-book solution but you could attach an onclick event handler to each of the buttons (or iframe container).
Also, for the Facebook API you can use edge.create. I am not too familiar with the other APIs.

How to integrate Facebook in iPhone

I am working one of the application in which i have to implement facebook through FBConnect, i have done with that and it is working ,can post to the userwall, however the only thing which i didn't get is how to like any status updated by the user by default.Suppose in the appliction if user login and post anything through fbconnect that status should be automatically liked by default, i have search a lot however didn't find any solution.Please help me regarding for that
You probably can't do it in a single go. But you can get the POST_ID of the post you've just posted and then send HTTP POST request to https://graph.facebook.com/POST_ID/likes to achieve what you want.

Facebook Graph API post with attachment not showing on News Feed

I tried a number of methods of posting to Facebook using Graph API and I have a problem with creating a post with attachments not showing up in the News Feed.
If I post just a text message, it shows up in the News Feed. Anything that has an attachment goes only to the wall.
Does anyone have an idea on what is the cause of this and how to fix it?
I have no idea what was the cause of the issue, but I resolved it by creating a new Facebook App, with new ID. The same scripts that only posted to the wall started posting to the news feed on the new App ID.
I think it's because you're adding attachement or a link to your feed.
As per http://developers.facebook.com/docs/fbjs/streamPublish/
they say :
Updating a User's Status
You can use this method to simply update a user's status. When you do so, the status message appears at the top of the user's profile and on the Friends > Status Updates page. The message also appears in the stream with your application icon.
To use this method to set a user's status do the following:
* Do not include an attachment or action link. If you do, the story will get published and will appear in the stream and on the user's Wall only. It won't appear at the top of the profile or in the Status Updates page.
* Make sure the message is no longer than 420 characters. Otherwise, an error gets returned.
I know this is an old post but I was having the same issue and I resolved it. Since there wasn't a valid answer to this post and it came up in many of my searches in Google I thought I would add the answer.
The main issue that is happening here is a permissions issue with the App and Access Token created in https://developers.facebook.com.
You can both GET and POST attachements on a wall but you have to give the Users Access Token the permission to access it in the first place. You can do it like this.
1. Go to your application on FB
2. Click on Graph API Explore
3. Click on Get User Access Token
4. Click on user_photos and user_videos
There are many options here but to get the basic attachements which tend to be photos and video you can just select those two, but you can add as many as you want.
After clicking Get Access Token at the bottom to save it you have to login with your password then give your access toke permission for your account. Once you have done that you now how permission to access your feed attachements (photos and videos)
Here is what the Graph API output looks like showing the picture from the feed
Now keep this in mind this is a Short Lived Access Token which lasts about an hour and it will stop working. You have to convert this token to a permanent token and let me save you the time you will bang your head trying to figure that out because I wrote a php function that will generate your permanent token from your short lived token all in one shot for v2.9
Check out my post reply here
facebook: permanent Page Access Token?