Forum Discussion

catherine_OTX's avatar
14 years ago

REST API and users

How do I find the rest call that lists how many posts are new to a user once they login? Thanks! Catherine

  • Hi, Catherine.

     

    Getting the number of posts that are new is actually done by getting the total number of posts for a given node (board, category, etc.), then subtracting the number of posts the user has read. It's a bit round-about, but it gets the job done. Hopefully in the future, we'll have a method that merges both operations into a single REST call. The two calls might look like this:

     

    http://community.company.com/company/restapi/vc/boards/id/myboard/posts/count
    http://community.company.com/company/restapi/vc/boards/id/myboard/messages/read/count

    One thing to note about this method for getting unread posts, however, is that it will not work at the community level. While you can get the number of posts at the community level, you cannot get the number of posts the user has read. That call is restricted to categories, and any leaf nodes (boards, blogs, idea exchanges, etc.). I've run into this issue in the past, but my development team assures me it is not an insignificant addition, unfortunately.

     

    Hope that helps,

    Adam

4 Replies

  • AdamT's avatar
    AdamT
    Lithium Alumni (Retired)
    14 years ago

    Hi, Catherine.

     

    Getting the number of posts that are new is actually done by getting the total number of posts for a given node (board, category, etc.), then subtracting the number of posts the user has read. It's a bit round-about, but it gets the job done. Hopefully in the future, we'll have a method that merges both operations into a single REST call. The two calls might look like this:

     

    http://community.company.com/company/restapi/vc/boards/id/myboard/posts/count
    http://community.company.com/company/restapi/vc/boards/id/myboard/messages/read/count

    One thing to note about this method for getting unread posts, however, is that it will not work at the community level. While you can get the number of posts at the community level, you cannot get the number of posts the user has read. That call is restricted to categories, and any leaf nodes (boards, blogs, idea exchanges, etc.). I've run into this issue in the past, but my development team assures me it is not an insignificant addition, unfortunately.

     

    Hope that helps,

    Adam

  • RobbL's avatar
    RobbL
    Lithium Alumni (Retired)
    14 years ago

    One thing to always keep in mind whether you are getting the number of messages read from metrics or from REST, we have to assume that when a Topic is clicked and the user is taken to the Topic page, that they have read every message on that page. The number of posts shown per page, is set in the Admin in Board View Settings, but able to be changed by a user for their own viewing pleasure in their preferences,