Discourse에서 특정 게시물의 마지막 댓글 정보를 직접 가져올 수 있는 API가 있나요?

I need a discourse that can directly get the last comment information of a certain post by specifying only the post ID, without specifying the floor, to directly get the last comment information. Is there such an interface?

I would recommend using a data explorer query for that. You can programmatically run queries and get JSON results. Here you go:

-- [params]
-- post_id :post_id

SELECT
  p.id,
  p.topic_id,
  p.post_number,
  p.raw    AS raw_content,   -- Markdown/source
  p.cooked AS html_content,  -- Rendered HTML
  p.user_id,
  p.created_at,
  p.updated_at
FROM posts p
WHERE p.id = :post_id
  AND p.deleted_at IS NULL   -- drop if you want deleted posts too
-- AND p.hidden = false      -- optionally exclude hidden posts
LIMIT 1;

It is two different services, and can only be obtained by interfacing.

Maybe you could explain a little bit more what you’re trying to achieve? Then I could make you a Python script for example :smiling_face:

You can create the data explorer query, then call it using the API.

Thank you all, I have already solved it in other ways.

Do you mind sharing how you solved it? It could help others with the same question.

두 번의 API 호출을 통해 이루어집니다. 먼저 모든 댓글의 수를 가져온 후, 그 수를 기준으로 마지막 댓글만 가져오면 됩니다.