Forum Discussion

bhupen's avatar
bhupen
Advisor
10 years ago

Need some API

Hi All,   I need some API to achive some functionality. Also Iam putting some API here which I achived because it may help someone else.   1. Display all topics from the PlayStation General board...
  • Tim_h's avatar
    10 years ago

    I think there's existing ways to cover off what your looking for bhupen .

     


    bhupen wrote:

    2. Allow the user to Create a Conversation / New Thread with all the normal thread creation functionality (adding links, @mentions, inserting youtubelinks, etc)
    Remarks: API Required


     

    You can create posts using the API: http://community.lithium.com/t5/Community-API/bd-p/developers-rest-api?leaf-id=Message.reply#Message.reply

     

    If you do this via a custom page or a custom component you can use TinyMCE to create the same text editor the lithium page loads.

    The only functionality you'd be missing is @mention , lithium will need to advise if that's going to be available as an API.

     

    You should be able to use the same call for points 2 and 3.

     


    bhupen wrote:

    4. Support pagination to continue to browser more topics
    Remarks: API Required


     

    Pagination is supported by a custom component, or when making calls to API version 1 or 2 you can specify to start further into the list.

    The only caveat is with custom pages, the default pagination components break due to how they interact with the URL. You can always code your own as a custom component to read the page number from the URL.

     


    bhupen wrote:

    5. Display threads in the same way as seen on the PS General board in which threads are displayed chronologically from latest to earliest.
    Remarks: API Required


    If you want to replace the existing component for the forum pages with your own you can do anything you like with the data to display the pages. order them by latest reply, thread creation date, kudos etc

     

    http://community.lithium.com/t5/Community-API-v2/Message-resource/ta-p/113091

     

    eg the default view would do a query like this:

    SELECT * FROM messages WHERE board.id = 'wireless_support' order by conversation.last_post_time DESC

     But you could order them by post date like this:

    SELECT * FROM messages WHERE board.id = 'wireless_support' order by conversation.post_time DESC

     Or simpler:

    SELECT * FROM messages WHERE board.id = 'wireless_support' order by topic.id ASC

     

     


    bhupen wrote:


    6. Display all other information that is shown on the PS General board (Replies, Author Name, Likes, Latest Post Info
    Remarks:

    API for reply:
    messages/id/149/reply

    API for author:
    restapi/vc/messages/id/149/author

    API for Likes:
    restapi/vc/messages/id/149/kudos/count

    API for Latest Post:
    /restapi/vc/threads/recent

     

    Correct me If i put wrong api on point 6.


    You've got it for point 6, but as soon as you make the move to a community version which supports API V2, you can get all of that and more.

    In a single query pull back XML for the post subject and body, reply count, kudos and views, any tags, embedded images.