Я использую restfb для создания поста на странице Facebook с child_attachments (карусель).
Это код, который создает DefaultFacebookClient и пытается опубликовать сообщение:
public String post(List<News> newsList)
{
try
{
FacebookClient facebookClient = new DefaultFacebookClient(ACCESS_TOKEN, APP_SECRET, Version.LATEST);
List<Post> attachments = new ArrayList<>();
for(int i = 0; i < 4; i++)
{
PostCallToActionValue postCallToActionValue = new PostCallToActionValue();
postCallToActionValue.setLink(newsList.get(i).GetNewsUrl());
postCallToActionValue.setLinkTitle(newsList.get(i).GetTitle());
PostCallToAction postToAction = new PostCallToAction();
postToAction.setType("NO_BUTTON");
postToAction.setValue(postCallToActionValue);
Post post = new Post();
post.setPicture(newsList.get(i).GetImageUrl());
post.setName(newsList.get(i).GetTitle());
post.setLink(newsList.get(i).GetNewsUrl());
post.setCaption("Asewome description here ...");
post.setDescription(newsList.get(i).GetDescription());
post.setCallToAction(postToAction);
attachments.add(post);
}
FacebookType publishMessageResponse = facebookClient.publish(FACEBOOK_PAGE + "/feed",
FacebookType.class,
com.restfb.Parameter.with("message", "Awesome message here ..."),
com.restfb.Parameter.with("multi_share_end_card", false),
com.restfb.Parameter.with("child_attachments", attachments)
);
String facebookUrl = "http://www.facebook.com/permalink.php?story_fbid=" + publishMessageResponse.getId() + "&id=" + FACEBOOK_PAGE;
return facebookUrl;
}
catch (RuntimeException e)
{
throw e;
}
}
Я получаю эту ошибку от Facebook Api:
"Received Facebook error response of type OAuthException: (#100) Invalid keys \"likes\" were found in param \"child_attachments[0]\". (code 100, subcode null) 'null - null'"
После большого изучения Open Graph, я понятия не имею, что это за "лайк".
Любой совет?
Заранее спасибо!