# 카테고리의 기본 주제를 삭제할 수 없습니다

**URL:** https://meta.discourse.org/t/cant-delete-the-default-topic-of-a-category/274834
**Category:** Development
**Tags:** rest-api
**Created:** [8월 11, 2023, 5:57오후 UTC](https://meta.discourse.org/t/cant-delete-the-default-topic-of-a-category/274834 "2023-08-11T17:57:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jucajuca](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jucajuca](https://meta.discourse.org/u/jucajuca)
#### Post date: [8월 11, 2023, 5:57오후 UTC](https://meta.discourse.org/t/cant-delete-the-default-topic-of-a-category/274834/1 "2023-08-11T17:57:39Z")

</div>

안녕하세요. API 엔드포인트를 사용하여 주제를 삭제하려고 시도하고 있습니다.

일반적인 주제는 삭제할 수 있지만, 기본 주제는 삭제할 수 없는 문제에 부딪혔습니다. 해당 주제는 "About the \_\_\_\_\_\_\_\_ category"라고 명명되어 있습니다.

{{baseUrl}}/t/{{id}}.json

질문은 다음과 같습니다:

- 이 주제를 API를 통해 어떻게 삭제할 수 있을까요?
- 이 주제를 API를 통해 어떻게 식별하여 건너뛸 수 있을까요?

예시

```plaintext
    url = base_url + "/c/" + slug + "/22.json"
    response = requests.request("GET", url, headers=headers, data=payload)

    for topic in response.json()["topic_list"]["topics"]:
        # 각 주제를 삭제합니다

        url = base_url + "/t/topic_id.json".replace("topic_id", str(topic["id"]) )
        response = requests.request("DELETE", url, headers=headers, data=payload)

```

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [8월 11, 2023, 6:01오후 UTC](https://meta.discourse.org/t/cant-delete-the-default-topic-of-a-category/274834/2 "2023-08-11T18:01:41Z")

</div>

카테고리 설명의 주제를 "미상장"으로 설정할 수 있습니다. 저는 모든 카테고리에서 그렇게 하고 있어요. API를 통해 미상장된 주제를 식별할 수 있다고 생각하는데, 맞나요?

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [8월 11, 2023, 7:05오후 UTC](https://meta.discourse.org/t/cant-delete-the-default-topic-of-a-category/274834/3 "2023-08-11T19:05:24Z")

</div>

이 토픽들을 삭제하려는 이유가 무엇인지 공유해 주실 수 있을까요? 해당 토픽들은 삭제할 수 없도록 설계된 특수 토픽입니다.

모든 토픽을 삭제한 후 카테고리를 삭제하는 것이 목표라면, About 토픽을 삭제하지 않고 카테고리를 삭제할 수 있습니다.

About 토픽을 어떻게든 없애고 싶다면, @Lilly가 제안한 대로 목록에서 제외(unlist)하는 것이 올바른 방법입니다.

> [@jucajuca](#):
>
> - API를 통해 해당 토픽을 어떻게 식별하여 건너뛸 수 있나요.

이 게시글들은 고유한 속성이 없는 것 같습니다. `category` 테이블의 `topic_id` 컬럼을 통해 특수 토픽으로 식별됩니다.

`/c/{id}/show.json` 엔드포인트를 통해 이를 가져올 수 있습니다: [https://docs.discourse.org/#tag/Categories/operation/getCategory](https://docs.discourse.org/#tag/Categories/operation/getCategory).  
`topic_url` 키를 찾으세요.

예를 들어:

[https://meta.discourse.org/c/7/show.json](https://meta.discourse.org/c/7/show.json)

```json
"topic_url": "/t/about-the-dev-category/1026"

```

* * *

관심 있으시다면, 조금 더 기술적인 정보를 드리겠습니다.

삭제 방지 🛡 로직은 여기에 있습니다: [discourse/lib/guardian/topic\_guardian.rb at 7ecaf6295daf8759aa98d00e7035c4dc0f853303 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/7ecaf6295daf8759aa98d00e7035c4dc0f853303/lib/guardian/topic_guardian.rb#L165)

그리고 사용된 메서드는 여기에 정의되어 있습니다: [discourse/app/models/topic.rb at 7ecaf6295daf8759aa98d00e7035c4dc0f853303 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/7ecaf6295daf8759aa98d00e7035c4dc0f853303/app/models/topic.rb#L1852)
