开发者

How to insert newline in "caption" attribute through Facebook Graph API wall post?

I've seen apps post links with "captions" to user's walls and they have a newline in them. Foursquare is one of these apps.

I开发者_JAVA百科 cannot figure out how to get a newline recognized and I've tried everything, including just passing in "\r\n", "\n", etc.

(note: I'm talking about publishing to a user's wall -- http://developers.facebook.com/docs/reference/api/post/)


Turns out the way to do this easily is to provide both caption and description parameters with the HTTP POST. Caption will be the first line, and Description will act as the second.


Use the following:

<center></center>

as part of your caption string. It will create a line-break for you when posting the link.


Try using properties arguments in graph api:

https://graph.facebook.com/me/feed?message=he&access_token=<ACCESS_TOKEN>&properties={1:{'text':'something',href='http://www.example.com'},2:{'text':'anything',href='http://www.example.com'}}

This will publish post in 2 lines... (Note: json should be converted to string before processing)


Try using only description instead of caption.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜