Ilya Gazman
Ilya Gazman

Reputation: 32261

Custom objects Facebook android open graph

I am trying to create custom object using facebook SDK like this:

Bundle params = new Bundle();
params.putString("type", "android_themes:background");
params.putString("url", "http://samples.ogp.me/471503979602314");
params.putString("title", "Sample Background");
params.putString("description", "");

Request request = new Request(
    Session.getActiveSession(),
    "me/objects/android_themes:background",
    params,
    HttpMethod.POST
);
Response response = request.executeAndWait();
// handle the response

But I am keep getting this error:

{Response: responseCode: 400, graphObject: null, error: {HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: Cannot specify type in both the path and query parameter.}, isFromCache:false}

Any ideas what is this mean? And what will I get when I be able to do it right? I am not so sure... P.S Publishing actions on my predefined objects works fine, just this problem.

Upvotes: 1

Views: 2265

Answers (1)

phwd
phwd

Reputation: 19995

The object is a JSON-encoded version of an object, the sample code generated for you was incorrect. Also remove type from the parameter list.

The object: The object is a JSON-encoded version of an object. The types used here are the types used in the books.book type. You can also include any of the standard properties. Note that the type is not included in the call. This is because it's implied from the path that you used when you made the call. See properties for why there's a data element in the JSON.

It is used to create objects which can then be used to create actions. See Facebook developers

Upvotes: 2

Related Questions