Forum Discussion

luk's avatar
luk
Boss
8 years ago

[Bug] REST API v1 /topics calls return wrong count

I recently ran into issues when trying to build a custom pagination component that was sometimes trying to get the total amount of topics/threads via /threads and other times via /topics, the results were inconsistent. After some digging it seems, that all /topics calls for REST API v1 return a wrong count for the total amount of threads/topics. In the example that follows, the correct count is 17, but /topics or /topics/count both return 18.

 

this is a call to /topics on a tkb board node, obviously the total amount of messages/topics is 17 (as seen in the "messages": [] property of the response, nonetheless the "count" property of the response says 18, a call to /topics/count returns 18 as well.

This is a call to /threads on the same node (any url params are exactly the same!): as can be seen there is a) no "count" returned, which is inconsistent BTW =) and b) the "thread": [] property holds again 17 items, a call to /threads/count also returns 17

When doing the same via API v2 the correct count/size of items is returned as well: 17

 

I'm not sure how long this is an issue, anybody had the same issue? Or maybe DougS knows about that or even has a good explanation why this is?

5 Replies

  • luk- We had the same data discrepancy issue between API V1 and API V2. We get it fixed from lithium support. You should use API V2 until the issue get resolved by lithium support.

  • luk's avatar
    luk
    Boss
    8 years ago
    Yeah, doing that usually, but have a case where that's not possible and then I need to fix the issue by subtracting 1 from the count, which is kind of awkward =)...
  • luk- Not recommended but if there is no other option left you can use this. As in our case too, We were getting API V1 count one less than API V2.  What is the case which won't let you use API V2?

  • luk's avatar
    luk
    Boss
    8 years ago
    Featured topics that are not returned correctly and seem to have broken completely with 17.9 (reported last week if I remember correctly)...works with v1.

    The funny thing is, that with /threads the count is correct, but not with /topics...
  • DougS's avatar
    DougS
    Khoros Oracle
    8 years ago

    /topics call is search-backed, but the /topics/count goes to the DB. V2 is search-backed for both the results and the count are search-backed. I'd have to look at the site to determine why the DB is returning 18 when search is returning 17, but it's probably something with permissions. Support should be able to help get this resolved.

     

    -Doug