Skip to content

Get with only parameters fails #156

Closed
prabirshrestha opened this Issue Apr 12, 2012 · 2 comments

1 participant

@prabirshrestha
Facebook SDK for .NET member

These are valid graph requests. https://graph.facebook.com/?ids=4,7 and https://graph.facebook.com/?domain=blog.prabir.me

Currently FB C# SDK does not allow us to execute the following code:

var fb = new FacebookClient();
dynamic result = fb.Get(new { ids = new[] { 4, 7} });
result = fb.Get(new { domain = "blog.prabir.me" });

ArgumentNullException is thrown Value cannot be null. Parameter name: path

@prabirshrestha
Facebook SDK for .NET member

This code will still not work due to url encoding and is the expected result.

dynamic result = fb.Get(new { ids = new[] { 4, 7} });

Rather you will need to use

dynamic result = fb.Get(new { ids = "4,7" });

It now behaves exactly like the javascript sdk.

// fails
FB.api('', {ids:[4,7]}, function(res) { console.log(res); });

// executes correctly
FB.api('', {ids:'4,7'}, function(res) { console.log(res); });
@prabirshrestha
Facebook SDK for .NET member

Facebook now supports specifying ids parameters as array. https://developers.facebook.com/blog/post/2012/08/01/platform-updates--operation-developer-love/

https://graph.facebook.com/?ids=["http:\/\/www.facebook.com\/","http:\/\/developers.facebook.com\/"]

The following code will now work without any updates/code changes to Facebook C# SDK.

var fb = new FacebookClient();
dynamic result = fb.Get(new { ids = new[] { 4, 7 } });
Console.WriteLine(result.ToString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.