# 카테고리 내 모든 첫 게시물을 가져오는 최적의 API

**URL:** https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883
**Category:** Development
**Tags:** rest-api
**Created:** [9월 30, 2021, 4:00오후 UTC](https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883 "2021-09-30T16:00:50Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![John\_Lehmann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/john_lehmann/32/140084_2.png) [@John\_Lehmann](https://meta.discourse.org/u/John_Lehmann)
#### Post date: [9월 30, 2021, 4:00오후 UTC](https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883/1 "2021-09-30T16:00:51Z")

</div>

카테고리 내 모든 첫 번째 게시글을 가져오고 싶습니다(위키처럼 사용하지만, 실제 위키는 아닙니다).

가능하다면, 주제/게시글마다 개별 요청을 보내는 방식을 피하고 싶습니다.

현재까지 찾은 최선의 방법은 검색을 통해 주제를 가져온 후, 각 주제를 하나씩 조회하여 스트림에서 첫 번째 게시글을 추출하는 것입니다.

웹훅은 향후 좋은 옵션이 될 수 있지만, 당장은 PULL 방식으로 시작하고 싶습니다.

감사합니다!

---

<div class="post-metadata">

### Author: ![John\_Lehmann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/john_lehmann/32/140084_2.png) [@John\_Lehmann](https://meta.discourse.org/u/John_Lehmann)
#### Post date: [10월 4, 2021, 1:51오후 UTC](https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883/2 "2021-10-04T13:51:19Z")

</div>

혹시 아이디어가 있으신 분 계신지 확인하려고 이 글을 올립니다.

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [10월 4, 2021, 3:01오후 UTC](https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883/3 "2021-10-04T15:01:41Z")

</div>

> [@John\_Lehmann](#):
>
> 가능하다면, 주제/게시물별로 하나의 요청을 보내는 것을 피하고 싶습니다.
> 
> 지금까지 찾은 최선의 방법은 검색을 사용해 주제를 가져온 다음, 각 주제를 하나씩 가져와 스트림에서 첫 번째 게시물을 추출하는 것입니다.

여러 주제에 대한 첫 번째 답변을 일괄적으로 가져오는 방법에 대해서는 알지 못합니다. 각 주제를 순회하며 첫 번째 게시물을 가져오는 것이 아마도 최선의 선택일 것입니다.

> [@John\_Lehmann](#):
>
> 웹훅은 미래에 좋은 옵션이 될 것이지만, 우리는 PULL 방식부터 시작하고 싶습니다.

네, 웹훅은 실제로 여기서 좋은 옵션이며, "Post Event"를 트리거로 사용할 수 있습니다.

 ![image](https://global.discourse-cdn.com/meta/original/3X/2/6/26838c8331e3dcbf495864e4f8164474e3242174.png)

하지만 이는 모든 게시물 이벤트에 대해 트리거가 발생하므로, 주제에서 첫 번째 답변이 아닌 모든 게시물은 무시해야 합니다.

---

<div class="post-metadata">

### Author: ![simonk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simonk/32/247950_2.png) [@simonk](https://meta.discourse.org/u/simonk)
#### Post date: [10월 4, 2021, 3:43오후 UTC](https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883/4 "2021-10-04T15:43:37Z")

</div>

원하시는 데이터를 반환하는 #data-explorer 쿼리를 작성한 후, 해당 쿼리를 API를 통해 실행해 보실 수 있나요?

> [@Discourse Data Explorer](https://meta.discourse.org/t/data-explorer-plugin/32566?u=simonk):
>
> discourse2Summary Discourse [Data Explorer](https://meta.discourse.org/t/32566?silent=true) allows you to make SQL queries against your live database, allowing for up-to-the-minute stats reporting.open_bookInstall Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately.information_source If you’re looking for examples or support for any custom queries, you can find lots of topics in our #data-reporting category under the #sql-query tag. If there’s not one to suit your par…

> [@Run Data Explorer queries with the Discourse API](https://meta.discourse.org/t/how-to-run-data-explorer-queries-with-the-discourse-api/120063?u=simonk):
>
> bookmark This guide explains how to use the Discourse API to create, run, and manage queries with the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) plugin. person_raising_hand Required user level: Administrator Virtually any action that can be performed through the Discourse user interface can also be triggered with the Discourse API. This document provides a comprehensive overview for utilizing the API specifically in conjunction with the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) plugin. For a general overview of how to find the correct API …

---

<div class="post-metadata">

### Author: ![John\_Lehmann](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/john_lehmann/32/140084_2.png) [@John\_Lehmann](https://meta.discourse.org/u/John_Lehmann)
#### Post date: [10월 4, 2021, 4:13오후 UTC](https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883/5 "2021-10-04T16:13:39Z")

</div>

@blake

![image](https://global.discourse-cdn.com/meta/original/3X/d/6/d66bd64854025cf902bbd9586d53b44762d0f5f0.png)

토픽 이벤트에 OP의 변경 사항도 포함되는 건가요?

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [10월 4, 2021, 5:25오후 UTC](https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883/6 "2021-10-04T17:25:14Z")

</div>

> [@John\_Lehmann](#):
>
> topic 이벤트에는 OP의 변경 사항이 포함됩니다

변경 사항에 대해 트리거가 발동되어야 합니다. 해당 설명에는 다음과 같이 적혀 있습니다:

> 새 토픽이 생성되거나, **수정** 되거나, **변경** 되거나, 삭제될 때.

> [@simonk](#):
>
> 원하는 데이터를 반환하는 #data-explorer 쿼리를 작성한 후, API를 통해 해당 쿼리를 실행해 볼 수 있나요?

네, 아주 좋은 옵션입니다! 🙂

---

<div class="post-metadata">

### Author: ![Tarun\_Sharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tarun_sharma/32/483195_2.png) [@Tarun\_Sharma](https://meta.discourse.org/u/Tarun_Sharma)
#### Post date: [4월 22, 2025, 6:49오전 UTC](https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883/7 "2025-04-22T06:49:24Z")

</div>

안녕하세요,

저희 **자체 호스팅 Discourse 인스턴스** 와 연동되는 **모바일 애플리케이션** 을 개발하고 있습니다. 특정 카테고리 내 토픽의 **첫 번째 게시글을 모두 가져와야** 하는데, 여기에서 논의된 사용 사례와 유사합니다.

현재 방식은 토픽을 가져온 후 각 첫 번째 게시글을 개별적으로 조회하는 방식이지만, 모바일 애플리케이션에 적합한 더 효율적인 방법을 찾고 있습니다. 이상적으로는 API 호출 횟수를 최소화하여 대역폭을 절약하고 성능을 향상시키는 것이 목표입니다.

비슷한 솔루션을 구현해 보신 분이나 가장 효율적인 방법에 대한 조언을 주실 수 있는 분이 계신가요? 여러분의 통찰력과 제안이 큰 도움이 될 것입니다!

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [4월 24, 2025, 6:24오후 UTC](https://meta.discourse.org/t/best-api-for-all-first-posts-in-a-category/204883/8 "2025-04-24T18:24:46Z")

</div>

위에서 언급된 데이터 탐색기 쿼리 라우트를 시도해 볼 가치가 있다고 생각합니다. 이렇게 하면 카테고리별로 하나의 요청을 보내면 됩니다.
