Forum Discussion

amuthan's avatar
amuthan
Adept
8 years ago

How to retrieve recent posts with replies count and solution mark?

I need to retrieve the post which has answer and replies count

5 Replies

  • Hi amuthan,

    You can use V2 Query to fetch recent posts with replies count and accepted solution.

    V2 Query:
    Select replies.count(*),id,subject,post_time,conversation.solved from messages where depth = 0 ORDER BY post_time DESC

    Hope this helps.
  • Hi,

    I am using V1 rest API.Can you we get the same using V1?
  • cike's avatar
    cike
    Champion
    8 years ago

    Hi amuthan,

     

    if you want to use APIv1, you have to use multiple request to get all information. Take a look at the message resource of APIv1:

     

    There you get a request for replies:

    http://community.lithium.com/community-name/restapi/vc/messages/id/[id]/replies/count

    and an other one for the solution marker:

    http://community.lithium.com/community-name/restapi/vc/messages/id/[id]/solutions/solution

    Best regards,

    Christian

  • amuthan's avatar
    amuthan
    Adept
    8 years ago

    Thanks for the reply.

     

    I need it as single endpoint that should give root message topic,replies count,solution there or not,timestamp,author id with image.

    Performance based approach is needed.

  • cike's avatar
    cike
    Champion
    8 years ago

    Regarding to your requirement to get all those information from only one endpoint, I would recommend developing a custom endpoint by yourself. Within the endpoint you can request the Lithium API resources an concat them to a response object which fits in your requirements.

    So, components in your frontend will only need one AJAX request to this endpoint (which does the "expensive" API calls on the server side). For example you can build a JSON-Object which is returned by this endpoint and can be processed in other components.

     

    Best regards,

    Christian