Forum Discussion

khill's avatar
khill
Mentor
8 years ago
Solved

REST API v2 Multiple Posts with the Same Depth Value

Hi Community,

 

I am working with the REST API V2 messages tables and keep getting instances where a two posts (different post ids) on the same topic have the same depth.

 

Example:

TopicID = 000000 PostID = 111111 Depth = 1

TopicID = 000000 PostID= 222222 Depth = 1

 

Is this an actual possible scenario? My understanding was that Depth was a unique value for each topic, thus there could be no repeating values.  Any ideas?

 

Thanks,
Kate

  • khill  As mentioned by DougS  depth is an indicator of message position.  In a thread, there will be only one message having depth 0 which is called topic. All other messages will have depth > 0.  See screenshot here

    But DougS reply of reply will have depth 2 not 1.  See screenshot here

4 Replies

  • DougS's avatar
    DougS
    Khoros Oracle
    8 years ago

    Hi Kate,

     

    Depth is an indicator of a message's position within a thread. The topic message has a depth of 0 (since there can only be 1 topic message in a thread, it will be the only message within the thread that has a depth of 0), replies to the topic message have a depth of 1. Replies to replies to a topic message have a depth of 1, etc. 

     

    -Doug

  • VikasB's avatar
    VikasB
    Boss
    8 years ago

    khill  As mentioned by DougS  depth is an indicator of message position.  In a thread, there will be only one message having depth 0 which is called topic. All other messages will have depth > 0.  See screenshot here

    But DougS reply of reply will have depth 2 not 1.  See screenshot here

  • khill's avatar
    khill
    Mentor
    8 years ago

    Ah perfect explanations - thank you VikasB and DougS

     

    In which case, it sounds I'll have to add an extra parameter to calculation of first reply where reply depth = 1 and post date is min.

  • VikasB's avatar
    VikasB
    Boss
    8 years ago

    khill  Unfortunately, lithium does not support depth=1. Either you can use  depth=0 or depth!=0.

    But your problem can be solved like this even without using depth parameter. As it would get only first replies of the topic. 

    select id,subject,post_time from messages where parent.id='121' order by post_time ASC limit 1