Dino Rino
Dino Rino

Reputation: 55

Create a common Object facebook sdk android fitness.runs

I try to create a common object with this code:

Bundle params = new Bundle();
params.putString("type", "fitness.course");
params.putString("url", "http://samples.ogp.me/136756249803614");
param.putString("title", "Sample Course");       
params.putString("description", "");
Request request = new Request(
Session.getActiveSession(),
"me/objects/fitness.course",
params,
HttpMethod.POST, new Request.Callback(){
@Override
public void onCompleted(Response response) {
if(response.getError()==null)
System.out.println("Object succesfully created!!");
else
System.out.println("Object NOT  Created!!"+response.getError());                            
               }}
             );
Response response = request.executeAndWait();

but I read this in my Logcat:

  10-07 15:33:04.009: I/System.out(23284): Object NOT created!! {HttpStatus: 400, errorCode: 2500, errorType: OAuthException, errorMessage: Cannot specify type in both the path and query parameter.}

I dont understand the error message... What do I do to create a Course object and update the data (gps status) of my course? I need of a back end server to store the data of my course? The back-end server is only an option?

Upvotes: 0

Views: 699

Answers (1)

Kasra Rahjerdi
Kasra Rahjerdi

Reputation: 2503

Your error message says all, you're supplying og:type from both your POST request and your URL.

As of the new FB OpenGraph SDK, you can have ad-hoc URL-less objects. What you're trying to do is use that API while at the same time using the self-hosted version of the API.

I'd suggest either taking the URL parameter out, taking og:type out of the URL you have set up, and definitely giving the documentation a second read. Here is the documentation for self hosted objects and here is the article for app owned objects.

Upvotes: 1

Related Questions