Publishing a single facebook post with multiple photos - c#

Is there a way to publish a single post with multiple photos? e.g. - sample facebook post
You can do this on the Facebook Page when composing a post (composing a post with many photos).
I came across this post but I don't want to create a story.
I want to create a POST on the PAGE with a collection of photos that I can track likes and comments on like the example stated earlier.
I am using the Facebook SDK.Net that has a batch upload feature - but that creates a post per photo.
Is there a way it be done? Or are there any suggestions?

I do not believe that it is possible to do a Post with multiple photos using the Graph API. Creating a Facebook Post means sending a POST to the endpoint https://graph.facebook.com/me/feed. In that endpoint, you can include a "picture" property in the query string. This is the URL of the picture you want to include in the Facebook post. In your created post Facebook does not reference your picture from that URL, it makes a copy.
Example POST request:
https://graph.facebook.com/me/feed?message=check%20out%20this%20picture&picture=http%3A%2F%2Fwww.mydomain.com%2Fmyphoto.png
On the desktop and mobile apps, you can add as many photos as you like but they are still uploaded individually. Using the console you can see that they are uploaded using the endpoint https://upload.facebook.com/ajax/composerx/attachment/media/saveunpublished It is only after you press the "Post" button are they then associated with your status message.

Related

Get Response Headers from UWP WebView

I've been searching for hours and couldn't find any solution to this problem.
I'm developing a UWP App and I have a WebView that goes to a website (where the user authenticates) and I should be able to get the access_token after he logs in.
Is there a way to get the response header from the page?
Or do I have to do everything manually (create the HttpClient, send the POST with the login info, and get the header response that way?)
First and foremost, the latest guidance is that authentication should not be done inside a web view, the modern approach is to open external browser window, where the user authenticates and is then redirected back to the app using a custom URI scheme. See a detailed post on this here on SO.
Now, the unfortunate answer is that WebView does not offer a built-in way to access the HTTP response and its headers. This has been requested (see for example this blog post by Martin Suchan), but was not implemented so far. If you have control over the web page, then you could store the authentication info in cookies, which are accessible. Not even injecting custom JavaScript can help here, because getting the HTTP headers is possible if you initiate an AJAX request in JS, but you can't get headers for a page that is already loaded.
As mentioned in comments above, the better solution would be to code the login manually using HttpClient or see if the service support a proper OAuth2/OpenID Connect flow in which case you could use a library like IdentityModel.OidcClient2 which can handle most of the heavy lifting for you.
You can also use the built-in WebAuthenticationBroker, see docs here.

How do I upload photos with my Blogger posts via Google's .Net API Client Library?

I've been able to successfully post to my blog using this library, but can't figure out how to upload and reference images with the post (similar to how Picasa's "Blog This" feature works).
There is no straightforward way. The images uploaded on Blogger are first uploaded to Picasaweb. So you need to work on picasa as well as Blogger API.
You can try the following steps:
Create a UI to select image from your system.
Use Google Picasa API to Upload image.
Get link of the uploaded Image and add it to your Blog's HTML code.

Grabbing facebook stats with a c# app

I have found many examples of getting data from facebook manually.
Is there a way to grab the data using an application (not a web app)?
What we are doing is creating a data repository for our customers so they can look at their data from FB, GA, twitter ect all in one place.
Facebook has me stuck as I can get an authentication code, but none of the URLs such as https://graph.facebook.com/me/friends?access_token=... will work. Guessing because "me" means I need to be logged into my site for it to work.
Any help/examples would be great.
Thank You

Really Need a Facebook App to post to Facebook Page Wall?

I'm using the Facebook API Graph (C# & ASP.NET) to try to dynamically post to a Facebook page I created.
Looking at the code samples floating around.. they suggest creating a Facebook App first (which I have done)..
However..
I have 3 different pages I want to post to.. Do I need to create an app for each? (I want to post different things to the 3 pages, not the same posts to each)
I just want messages & links to appear as Wall posts. I'm not bothered about having an 'app' that has 'canvas' that is placed in an IFrame.
Question : So do I still need to write one or more Facebook Apps to post to my 3 different Facebook pages??
Where I am so far.. I can pass in my apps credentials and get back the access_token. But my posts don't appear to be going anywhere.
I'd rather drop the 'facebook application /canvas' approach if possible If I can post directly to a wall (For the above reasons).
Oh, and before you ask. I don't want to post to my Apps Wall page, I want to post to my other pages (Unless I have to post to my Apps Wall page first?).
I'm sure loads of people have the same questions..
Thanks in advance.
-- Lee
You can do this with only one app
You'll need these permissions offline_access, publish_stream,
manage_page
After "me" request in response you should parse active_tokens of pages
you administer
Before you make publish request make sure you set
"_facebook.active_token" to
active_token of page where you want
to publish
I think you need to create the Facebook App, because that's the only way you'll get the set of API keys you need for using the API. I think that's the only reason. It's the same when you're using Facebook only for authentication.
1 - I have 3 different pages I want to post to.. Do I need to create an app for each?
No because there is an option to allow an single app to handle multiple pages.
2 - I just want messages & links to appear as Wall posts. I'm not bothered about having an 'app' that has 'canvas' that is placed in an IFrame.
You can do that surely with the help of their Graph API.
You don't necessarily need a canvas, though keep in mind that's where users will go when they click on the name of your app.
Take a look at the Graph API: http://developers.facebook.com/docs/api, particularly the Publishing section. You want to use /PROFILE_ID/feed, where PROFILE_ID is the id of the page you want to post to.

Is there a way to programmatically remove friends on Facebook?

It sure is a pain to prune a Facebook profile. Is there any way using the Facebook API (or some other mechanism) to authenticate as a particular user and remove friends from the user's list? I have looked through the API documentation, but I'm not familiar with the ins and outs of the platform.
I have been through the complete facebook graph api documentation on facebook while i was writing my open source .net sdk for facebook. From all that i understand, i am 99.9 % sure that this cannot be done using their api. You can create status messages, links, photos, albums, events, pages, notes etc using their api ( you need to perform simple post operations for all this ), but i have read no where that a friend can be removed using facebook api !
No API but you can program your browser or mimick a browser. Think of QtWebKit. I doubt if you need to add so many friends and just to remove them using machine.

Categories

Resources