Get all photos from Picasa by person - c#

Is it possible to get all photos by a persons name through the Picasa Web Albums Data API?
All examples I can find, shows how to get photos by an albumid.

You can request a list of the most recent photos, with a very high value for max-results.
I'm not sure if you are using the .NET API Client Library, but if so, an example is here:
http://code.google.com/apis/picasaweb/docs/1.0/developers_guide_dotnet.html#ListRecentPhotos
Use query.NumberToRetrieve to set the value for max-results.
If you are not using the .NET Client Library, an example using HTTP protocol can be found here:
http://code.google.com/apis/picasaweb/docs/2.0/developers_guide_protocol.html#ListRecentPhotos

You can retrieve facial recognition data from the Picasa Web API through a (currently) undocumented API URL that is used by the Picasa desktop application. More info here:
http://klick.com/pharma/blog/2011/09/retrieving-face-tag-data-from-the-picasa-web-api/

by setting "default" that mean retrieving current user with that code you can retrive the user photos in specific album
PhotoQuery query = new PhotoQuery(PicasaQuery.CreatePicasaUri("default", albumId));
PicasaFeed feed = picasaService.Query(query);
foreach (var entry in feed.Entries)
{
PhotoAccessor photoAccessor = new PhotoAccessor((PicasaEntry)entry);
Photo photo = new Photo();
photo.Title = photoAccessor.PhotoTitle;
photo.Summary = photoAccessor.PhotoSummary;
photo.MediaUri = entry.Content.AbsoluteUri;
photo.Id = photoAccessor.Id;
photo.AlbumId = photoAccessor.AlbumId;
photos.Add(photo);
}

If you know the subjectid then using an RSS link you can get a feed of ALL images for that user regardless of albums. The link is:
http://picasaweb.google.com/data/feed/base/user/PICASA_USERNAME?alt=rss&kind=photo&subjectids=SOME_BIG_LONG_STRING_OF_CHARACTERS
Also, you can find the subjectids by going to each person on PWA and clicking the RSS link at the bottom of the page.
I am stil trying to find a way to get all subjectids without a manual lookup.
Source: http://credentiality2.blogspot.com/2010/02/picasa-gdata-api-and-face-recognition.html

Related

Facebook page /feed missing images

I was using the Facebook Public API Feed for the longest time and since they deprecated it I've been trying to find a replacement method in C#.
I am able to get my page posts but any post that contains images I only get the message and no images. After spending the past weekend trying to find a way I am desperate to know if anyone has had any success in getting full page post content from the Facebook C# SDK library.
Here is what I have and it works for getting the posts but they do not contain any images.
var fb = new FacebookClient
{
AppId = ConfigurationManager.AppSettings.Get("FacebookAppID"),
AppSecret = ConfigurationManager.AppSettings.Get("FacebookAppSecret"),
AccessToken = ConfigurationManager.AppSettings.Get("FacebookAccessToken")
};
var pageFeed = string.Format("/v2.4/{0}/feed", _facebookPageId);
dynamic response = fb.Get(pageFeed);
Since the upgrade in Graph API v2.4. Only a limited set of data is sent via FB unless specifically requested. You should pass the fields parameter with the keyword of data which you would like to retrieve.
A list of keyword is available here
In your case, the request statement would be:
var pageFeed = string.Format("/v2.4/{0}/feed?fields=id,message,picture", _facebookPageId);
To get all pictures from a post: replace picture with attachments, as picture will return the very first picture linked to the post.
var pageFeed = string.Format("/v2.4/{0}/feed?fields=id,message,attachments", _facebookPageId);

Post Media to User/Page Wall in Facebook with C# SDK

I'm using Facebook .Net SDK(http://facebooksdk.net/) in my application. I need post an image to the wall of the user or his page.
I have this piece of code to try do this:
var postUrl = "<fbid>/feed";
var fbParameters = new Dictionary<string,object>();
fbParameters["message"] = postRequest.FacebookPostContent;
if (postRequest.MediaData != null && postRequest.MediaData.Length > 0)
{
var stream = new MemoryStream(postRequest.MediaData);
if (postRequest.ContentType.Equals("image/jpeg"))
{
postUrl = postUrl.Replace("/feed", "/photos");
fbParameters["picture"] = new FacebookMediaStream { ContentType = postRequest.ContentType, FileName = DateTime.UtcNow.ToString("ddmmyyyyhhmmss") + "-photo.jpeg" }.SetValue(stream);
}
}
if (!string.IsNullOrWhiteSpace(postRequest.FacebookPageId))
{
fbUserID = postRequest.FacebookPageId;
}
postUrl = postUrl.Replace("<fbid>", fbUserID);
var result = await facebookClient.PostTaskAsync(postUrl, fbParameters);
Look at my postUrl variable. I update the with the user ID in Facebook or the PageID if it is a page so the post should be properly posted in the right object. If there is some image to upload, so add it to the dictionary.
So, with it in mind, I have the following questions:
When the fbUserID is a user ID, the post happens perfectly, with the image and description but, when the ID is a PageID, only the description text is posted and image is just ignored(the user has the manage_page permissions so I dont think it is a permission issue). What I'm doing wrong that the image is not being posted to the page's wall?
If I want to post a video instead of a image, what should I change in this code?
Already saw many problems with other technologies here in SO but never a conclusive solution.
Thank you very much for the help, I really appreciate.
Regards,
Gutemberg
Got it!
Facebook creates a different section inside the page called Recent Posts by Others on Test Page where people allowed to post images will be there, like an attachment icon. In order to post directly to the page's feed/wall, all I need to do is instead of use the user access_token(even if user granted manage_pages permission) just use the access_token that comes in /me/accounts object for the respective page.
About the video post, I just set the ContentType to "video/mpeg" and at server instead of set picture parameter on dictionary, I've set the video field with the video byte[].
Thanks!
Regards,
As an alternative you could try the Share Content button shown in one of the answers here:
Upload video on Facebook using Graph REST API on Windows Phone 8.1
I found that to be easier than tackling authorization and manually posting.

How to get friends list from facebook? (Desktop application)

As per this link code from stack overflow i have try this code for getting
friendslist but after login i got this error "requires valid signature"
string APIKey = ConfigurationManager.AppSettings["API_Key"];
string APISecret = ConfigurationManager.AppSettings["API_Secret"];
Facebook.Session.ConnectSession connectsession = new Facebook.Session.ConnectSession(APIKey, APISecret);
Facebook.Rest.Api api = new Facebook.Rest.Api(connectsession);
var friends = api.Friends.GetLists();
foreach (var friend in friends)
{
System.Console.WriteLine(friend.name);
}
guide me to find out the solution
Thanks
ash
If you are starting with a new application, you should definitely use the Graph API and not the old Rest API. The Rest API has been deprecated for quite a while now and there is no guarantee how much longer Facebook will support it.
For an example on using the Graph API try http://csharpsdk.org/docs/web/getting-started
You can obtain the friends list by making a request to me/friends
You can test other requests using the Graph API explorer.

post items from to amazon.com using API

What API I should use to post items from asp.net (C#) web application to amazon.com ?
please guide me to proper documentation and steps.
What I am looking for is how to add new item into certain category and pass the item title/description/pictures/price etc... -- plz advice
Thanks
You're question is a bit vague, but this was the most useful link I found when researching into how to interface with Amazon using C# -
http://flyingpies.wordpress.com/2009/08/01/17/
You need the Marketplace Web Services API. Found at http://developer.amazonservices.com.
You then need the flat file feed specifications to send the flat file in the correct format to the MWS. That can be found after you're logged into your seller central account:
https://sellercentral.amazon.com/gp/help/help.html/ref=ag_13461_cont_help?ie=UTF8&itemID=13461&language=en_US
From there, you can simply send to the MWS the data you need. Here is a snippet of my code:
SubmitFeedRequest req = new SubmitFeedRequest();
req.ContentMD5 = MarketplaceWebServiceClient.CalculateContentMD5(feedContent);
feedContent.Position = 0;
req.FeedContent = feedContent;
req.FeedType = "_POST_FLAT_FILE_INVLOADER_DATA_";
req.PurgeAndReplace = false;
req.Marketplace = MarketPlaceId;
req.Merchant = MerchantId;
return Service.SubmitFeed(req);
Assuming that by 'posting' you mean posting new items into the amazon marketplace, you can use
this api https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html
Also google works wonders for searching
It sounds to me like you need the Amazon Market Place Feeds API.
https://developer.amazonservices.co.uk/gp/mws/api.html?ie=UTF8&section=feeds&group=bde&version=latest
You can use SubmitFeed to send product and inventory information to Amazon

Get Photos From Album Facebook C#sdk

i want to get album photos so far i have been able to get album info
I am using facebook c# sdk 5.0 for dot net framework 4
code so far is dynamic friends = app.Get("me/albums");
this provides data and we can get everything mentioned here http://developers.facebook.com/docs/reference/api/album/
but i cannot establish connection mentioned for photos
so far i have been able to find this method if there is a good or different approach then please let me know.
//Get the album data
dynamic albums = app.Get("me/albums");
foreach(dynamic albumInfo in albums.data)
{
//Get the Pictures inside the album this gives JASON objects list that has photo attributes
// described here http://developers.facebook.com/docs/reference/api/photo/
dynamic albumsPhotos = app.Get(albumInfo.id +"/photos");
}

Categories

Resources