I can fetch the comments for a post using the API using:

comment/list?post_id=

and that works fine but I have a question about how to determine what comment is a reply to another/ determining the comment nesting/threading.

From what I can tell the only thing tying any two comments together is the comment.path prop.

Is that correct?

That prop seems to be in a format where each nested comment has the root parent path number followed by . then their unique number. And each subsequent comment is another number sequence after that and so on.

Example:

root comment:

{ 
     "comment": {
          "path": 12345
     }
}

child comment 1:

{ 
     "comment": {
          "path": 12345.327928
     }
}

Is this correct?

Can someone who has used this API explain how this works? There are no doc comments in the docs for the http client so I’m just winging it here.

  • RoundSparrow@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    1 year ago

    There is a community for developers over at https://lemm.ee/c/lemmydev - might want to visit that server directly given how out of sync Lemmy.ml can be.

    yes, basically the path variable is how you organize repy branches. Name your language, there is likely some open source code on how to output a tree

    • subtex@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Awesome. Didn’t even know about that community. I’ll take my woes over there.

      Thanks!