0

I'm already some days looking and trying to solve this, but with no success so far.

I'm working with the Facebook SDK for .NET, trying to subscribe to real time facebook updates, inside a Web API project, following https://developers.facebook.com/docs/graph-api/reference/app/subscriptions/. But always getting "Parameter count mismatch" from Post, in the last line:

    string access_token = "xxx"; // getting from httpwebresponse https://graph.facebook.com/oauth/access_token
    var client = new FacebookClient(access_token);
    var parameters = new Dictionary<string, string>();
    parameters.Add("object", "page");
    parameters.Add("callback_url", "http://domainname.net/api/facebook/");
    parameters.Add("fields", "feed");
    parameters.Add("verify_token", "abc");

    var uri = string.Format("https://graph.facebook.com/{0}/subscriptions?", "123456789012345");
    var response = client.Post(uri, (object)parameters);

Error: An exception of type 'System.Reflection.TargetParameterCountException' occurred in mscorlib.dll but was not handled in user code

Additional information: Parameter count mismatch.

The callback_url is ok and was tested for answering the facebook verification.

Couldn't find good answers in the net. Can anyone help me please??

Thanks in advance. Dave

dtmourato
  • 1
  • 2

1 Answers1

0

I hope you found the answer already, but by the way, here is what I did. Try using a dynamic object as the parameter:

 var result = client.Post("YOUR_PAGE_ID/subscriptions",
                                new
                                {
                                    @object = "page",
                                    fields = "feed",
                                    callback_url = "http://your.callback.url",
                                    verify_token = "your verify token",
                                    access_token = "your access token"
                                });
Alfeu
  • 971
  • 9
  • 12