Forum Discussion

DylanGeorgeFiel's avatar
9 years ago

API returing different results from API V1/V2 and Studio

Hello,

 

I'm new to lithium,

 

I'm running the following queries from V1, V2

- SELECT count(*) FROM messages

 

restadmin('/metrics/name/net_overall_posts?js_string')

These are returning the following:

- 177 and 162

 

What is the difference between these two calls? Thanks,

 

Edit: When I create a new thread or reply, they both increment by one. I'll also add that when using the API Browser and calling the method I get 180. Which is different from the first query I'm making with a URL?

  • VarunGrazitti's avatar
    VarunGrazitti
    9 years ago
    Could be a reason, why don't you compare a normal V1 /posts/count call with this V2 instead of metrics call and see how it works.

8 Replies

  • DylanGeorgeFiel's avatar
    DylanGeorgeFiel
    Helper
    9 years ago

     I do not have sufficient privileges for this resource or its parent to perform this action.

     

    I've verified my account.

     

    Edit: I tried /metrics/name/overall_posts and it's giving me 304 posts?

  • VarunGrazitti's avatar
    VarunGrazitti
    Boss
    9 years ago

    DylanGeorgeFiel - ok, here is what document says:

     

    overall_posts: The overall number of posts, across all types of discussions (forums, blogs,etc.)
    net_overall_posts: The overall number of posts minus deleted posts, across all types ofdiscussions (forums, blogs, etc.)

     

  • DylanGeorgeFiel's avatar
    DylanGeorgeFiel
    Helper
    9 years ago

    That explains the increase in numbers from net_overall_posts and overall_posts is the deletions.

     

    It doesn't explain why the LiQL statement "SELECT count(*) FROM messages" differs by 10 or so posts from net_overall_posts.

     

    I noticed that the query originates from 'metrics', does this have something to do with it? Is the difference from hidden posts or something?

     

  • VarunGrazitti's avatar
    VarunGrazitti
    Boss
    9 years ago
    Could be a reason, why don't you compare a normal V1 /posts/count call with this V2 instead of metrics call and see how it works.
  • DylanGeorgeFiel's avatar
    DylanGeorgeFiel
    Helper
    9 years ago

    I couldn't find a reference to /posts/count.

     

    That did the trick to the calls returning the same value.

     

    However, the reason why they're different remains a mystery.

     

    Edit: The values differ depending on whether you're logged in or not as an admin. I'm unsure what the posts are.

  • VarunGrazitti's avatar
    VarunGrazitti
    Boss
    9 years ago
    DylanGeorgeFiel - The results would always vary in logged in and logged out case if you are making the REST call as rest("your_rest_call")

    It is because the REST call would respect all the permissions and not fetch the results which require login.

    If you were making the call as restadmin("your_rest_call"), it will fetch same results irrespective of login or logout.

    I hope this helps and clears the doubt you have.
  • Claudius's avatar
    Claudius
    Boss
    9 years ago
    The additional posts are likely to be in internal areas like abuse report, filter notices or internal moderation boards that are only accessible to moderators or admins.