C# Facebook webhook api returned JSON - c#

im trying to implement Facebook Real Time Update (webhook) , i do all the steps in the Facebook graph API documentation, and the result was JSON contain only few information about the change.
i want to get more information in the JSON result when user upload a delete a photo to his account , like getting new photo id,url or specify what is the real change.
these some photos for my webhook setting and result in codebehind
Webhook image
JSON result in code behind

To get more details, you will have to use the id to fetch the object using Graph API Get request. Then you may be able to compare the result with the previous values. Webhooks returns specific data inside entry object as described in https://developers.facebook.com/docs/graph-api/webhooks

Related

How to get document preview image using SharePoint CSOM

I would like to programmatically retrieve thumbnails of documents from SharePoint. What I'm trying to do is the following:
document.GetImagePreviewUrl(width, height, clientType);
This just returns an empty ClientResult. I am not sure what to enter as clientType value.
I have also tried to use this method programmatically (by using WebClient and downloading the file). But that just returns a 403 response.
The possible solutions I see here are the following:
Figure out what to enter as clientType and retrieve the preview url that way.
Figure out how to tell SharePoint that I am authorized programmatically (using WebClient and headers for instance).
I do need some help regarding these two options, I am not sure where to start since both options aren't well documented.
I've figured out a way to do it, the 403 error was caused because sharepoint had no idea who I was. After some research and fiddling I found out that the request you send to the preview page contains an authentication cookie. This cookie can be generated by code using this piece of code:
// Create an authentication cookie which we can send with the request so sharepoint knows who we are.
var authCookie = credentials.GetAuthenticationCookie(new Uri(imageUrl));
client.Headers.Add(HttpRequestHeader.Cookie, authCookie);
// Download the image data to a byte array
image = client.DownloadData(imageUrl);

Download attached file from Facebook using C# API

I able to download an image from facebook conversations using FB API but now i had a problem to download an attached file (.doc, .txt, .log and etc.) from facebook using graph FB API.
Json result return by Facebook if have attached file as below:
"message":"test sent attachment","attachments":{"data":[{"id":"10203275664207489","mime_type":"application/octet-stream","name":"service.log","size":432}]}},
Which is dont have any URL link to the file. But for image that json return by facebook contain url for the that picture. See Json below:
"message":"Gambaq","attachments":{"data":[{"id":"10203185045102068","mime_type":"image/jpeg","name":"10391434_10203185044782060_6466381862586755357_n.jpg","size":null,"image_data":{"width":720,"height":960,"is_sticker":false,"url":"https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpt1/v/t34.0-12/11304104_10203185045102068_881196838_n.jpg?
I use this API code for getting Json result:
dynamic resultsByApi = fb.Get("/" + fbFanPage + "/conversations?access_token=" + tokenPage + "");
My question here is anybody know how to get attached file URL for facebook conversations using FB API?
Can anybody please help me to solve this issues. Thank you in advanced.
To use the REST method to get the attachment data, it's
https://api.facebook.com/method/messaging.getattachment
With expected parameters are:
access_token=YOUR_ACCESS_TOKEN
mid=MESSAGE_ID
aid=ATTACHMENT_ID
format=json //(it defaults to XML otherwise)
{"content_type":"image\/png","filename":"jagadeesh.png ","file_size":14587,"data":<contents of data>}
its working v2.0 is expected..
also look at this fql details

Track Images(artwork_url) not returned by Soundcloud API

I am using Soundcloud API to retrieve a list a tracks in my windows phone app(using C#). In the .json file of the tracks, I see that there is no image returned for some tracks (i.e. "artwork_url":null).
(NOTE: On the other hand, in other 3rd party Soundcloud apps on WP8, I can see the same tracks along with their respective images.)
Is there any way I could receive complete information? Thanks in advance!
If its null, its not defined.
SC uses on their website a logic to use the default avatar when there is no artwork defined.
Compare with this sketch:
SC.get('/tracks/97617992', function(sound) {
console.log(sound.artwork_url);
$('#result').append('<img src="' +sound.user.avatar_url+'"/>' );
});
http://jsfiddle.net/iambnz/ngtzdx8c/

Access Unshipped Orders on Amazon MWS in C#

this is our first time using the Amazon MWS (or any API for that matter) and we want to pull all of the unshipped orders from our seller account. We've tried using many different methods (RequestReportRequest, with this link: http://www.amazonsellercommunity.com/forums/message.jspa?messageID=2370410, and more) but none seem to work. Is there a simple way to access our unshipped orders using C#?
Thanks for the help.
Should be the same in all supported languages.
You can request an report using the RequestReport API operation with ReportType being set to _GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_ . As a response you get a ReportRequestId which you store.
Next you periodically check the status of your report request by calling the GetReportRequestList operation, probably with the parameter ReportRequestIdList containing your ReportRequestId. The response tells you in which ReportProcessingStatus the reportRequest is. According to the sellercentral webpage it can take up to 45 minutes to finish a report.
Once the ReportProcessingStatus is DONE, you need to get the reportId. For this purpose you use the GetReportList operation with the parameter ReportRequestIdList set to your ReportRequestId. The response contains the reportId
Finally, you get your report by calling GetReport with the reportId you got in step 3.
For more details, have a look in the MWS API reference

Get Tweets of all users using TweetSharpAPI

I have implemented a method which manually scrapes the Search Twitter page and gets the tweets on different pages.
But since there is a fast refresh rate, the method triggers an exception.
Therefore I have decided to use TweetSharp API instead
var search = FluentTwitter.CreateRequest()
.AuthenticateAs(TWITTER_USERNAME, TWITTER_PASSWORD)
.Users()
.SearchFor("dumbledore");
var result = search.Request();
var users = result.AsUsers();
this code was on the site.
Does anyone know how I can avoid giving my credentials and retrieve from all users and not just the ones I have as friends?
Thanks!
What you want to do is interface with the Twitter Streaming API. This API allows you to open a persistent connection with Twitter and Twitter will then stream results to you as they come in.
(taken from the Twitter Streaming API page)
That said, TweetSharp doesn't currently support the Streaming API. However, it's not difficult to open a connection to Twitter in .NET and process the responses as they're received (however, I'd recommend using the HttpClient class to process this asynchronously, as well as using a proper JSON parsing library, like Json.NET).
Note the third column in the diagram "Streaming connection process", specifically the middle part:
Receives streamed Tweets, performs processing and stores result
As well as the "HTTP Server process" column:
Server pulls processed result from data store and renders view.
While not explicitly mentioned, you are best off just persisting the Tweet as you get it into a data store and then having another process handle the Tweets; the volume of Tweets you might get is so high that performing any processing when you get the Tweet will backlog the receiving of new Tweets.
For your specific case, you'll want to access the Public Streams with a POST filter of "dumbledore".

Categories