• Internet
  • 07.02.2018
  • EN

Simply RedDot: "Tiny C# Facebook Batch Request Connector"

written by Jian Huang, 8. March 2013


Recently, I have had the great joy of working on some Facebook events integration. The issue was that the requests were sent one at a time. Facebook batch request was the answer.

The existing code base is C#. I can use the popular C# Facebook SDK at http://csharpsdk.org/, but it might be overly complex for the project.

So I wrote this little C# Facebook Batch Request Connector: https://github.com/jhuangsoftware/FacebookBatchRequest

Can It Return Html?

Sure. Extend current project to covert returned JSON to HTML. Alternatively, use the current connector as part of your project, which actually converts JSON to HTML

Sample Code: Inline ASPX Code

<%@ Import Namespace="FacebookBatchRequestLib" %>
<%@ Import Namespace="System.Collections.Generic" %>
    FacebookBatchRequest FBBatchRequestObj = new FacebookBatchRequest("XYZ|XYZ");
    FBBatchRequestObj.AddBatchUrl(RequestMethod.GET, "something1/events?access_token=XYZ|XYZ&fields=name,description,start_time,end_time,location,id&since=2013-03-08&limit=15");
    FBBatchRequestObj.AddBatchUrl(RequestMethod.GET, "something2/events?access_token=XYZ|XYZ&fields=name,description,start_time,end_time,location,id&since=2013-03-08&limit=15");
    List<string> RetJSONs = FBBatchRequestObj.Send();

Just remember to drop FacebookBatchRequestLib.dll into the bin folder

Sample Code: Windows Application

Included in the GitHub project. Check it out or download here.

Source: Tiny C# Facebook Batch Request Connector

© copyright 2013 by Jian Huang