actions with multiple links in facebookClient.publish

169 views
Skip to first unread message

dejan

unread,
Jul 1, 2011, 2:10:39 AM7/1/11
to RestFB
I would like to have more than one action on my facebook post

this code works
String al1 = "{name:\"New York Times\",\"link\":\"http://
www.nytimes.com\"}";
FacebookType publishMessageResponse =
facebookClient.publish("me/feed", FacebookType.class,
Parameter.with("actions", al1));

but this one does not
String al1 = "{name:\"New York Times\",\"link\":\"http://
www.nytimes.com\"}";
String al2 = "{name:\"CNN\",\"link\":\"http://www.cnn.com\"}";
List<String> actionList = new ArrayList<String>();
actionList.add(al1);
actionList.add(al2);
FacebookType publishMessageResponse =
facebookClient.publish("me/feed", FacebookType.class,
Parameter.with("actions", actionList));


INFO: Facebook responded with HTTP status code 400 and response body:
{"error":{"type":"OAuthException","message":"(#100) actions should be
a JSON-encoded dictionary with \"name\" and \"link\" keys"}}
Exception in thread "main"
com.restfb.exception.FacebookOAuthException: Received Facebook error
response of type OAuthException: (#100) actions should be a JSON-
encoded dictionary with "name" and "link" keys
at com.restfb.DefaultFacebookClient
$DefaultGraphFacebookExceptionMapper.exceptionForTypeAndMessage(DefaultFacebookClient.java:
576)
at
com.restfb.DefaultFacebookClient.throwFacebookResponseStatusExceptionIfNecessary(DefaultFacebookClient.java:
537)
at
com.restfb.DefaultFacebookClient.makeRequestAndProcessResponse(DefaultFacebookClient.java:
485)
at
com.restfb.DefaultFacebookClient.makeRequest(DefaultFacebookClient.java:
445)
at
com.restfb.DefaultFacebookClient.publish(DefaultFacebookClient.java:
298)
at
com.restfb.DefaultFacebookClient.publish(DefaultFacebookClient.java:
307)
Reply all
Reply to author
Forward
0 new messages