Question

Basically, I have a custom object inheriting from place. I am creating a c# tool for creating the objects using the Facebook Sharp c# SDK located here I am using an app access token when making these calls.

I've tried various approaches and variation within:

  1. Here is a sample call that yeilds:

    (OAuthException - #100) (#100) The parameter object is required

    _api.AccessToken = GetExtendedToken().Token;
    var postdata = new Dictionary<string, object>
    {
        //{"fb:app_id", "appId"},
        //{"type", "myapp:myobject"},
        {"url", resort.Url},
        {"title", resort.Name },
        {"image", resort.Image},
        {"video", resort.Video},
        {"description", resort.Description},
        {"place:location:latitude", lat},
        {"place:location:longitude", long}
    };
    var response = _api.Post("/app/objects/myapp:myobject", postdata);
    
  2. if I uncomment the type parameter I get:

    (OAuthException - #2500) Cannot specify type in both the path and query parameter

  3. If I add the type back in, and remove the type from the path, I get a response of true but this should be something like id: 23049820398092384

  4. If I remove the place objects, or if I remove place and type, or if I remove place but use the type and change the get path, I still get errors.

Was it helpful?

Solution

refactored a bit. In this scenario I needed to assign the postdata information to an object as such below. also needed to stop using facebooksharp, their api does weird stuff to the request.

    var obj = new
    {
        app_id = appId,
        type = app_name:object_type",
        url = Url,
        title = Name,
        image = Image,
        video = Video,
        description = Description
    };

    var vars = new NameValueCollection {{"object", JsonConvert.SerializeObject(obj)}, {"format", "json"}, {"access_token", AppToken}};

    var url = "https://graph.facebook.com/app/objects/"+ _appName + object_type;
    return HttpTools.Post(url, vars);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top