# 카테고리별로 '해결됨' 필드를 프로그래매틱으로 활성화하는 방법

**URL:** https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476
**Category:** Support
**Created:** [12월 15, 2024, 1:35오전 UTC](https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476 "2024-12-15T01:35:17Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Steve\_John](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steve_john/32/435022_2.png) [@Steve\_John](https://meta.discourse.org/u/Steve_John)
#### Post date: [12월 15, 2024, 1:35오전 UTC](https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476/1 "2024-12-15T01:35:17Z")

</div>

안녕하세요, “Solved” 플러그인을 설치했으며 파이썬 스크립트를 사용하여 카테고리를 프로그래밍 방식으로 생성하고 있습니다. 이 카테고리 설정 필드를 "True"로 설정하려고 합니다. 스크립트를 실행하면 성공적으로 업데이트되었다고 표시되지만, 해당 카테고리 설정 필드를 확인해 보면 여전히 "False"로 남아 있어 "True"로 설정되지 않았습니다. 이 문제를 디버깅하고 수정하는 방법이 무엇인가요?

 ![이메일 게시 및 토픽 해결 설정 옵션이 포함된 웹페이지 스크린샷, 카테고리 저장 또는 삭제 버튼 포함. (AI 캡션)](https://global.discourse-cdn.com/meta/original/4X/0/f/4/0f4af549f42e3716a55236fe5bfb237469883166.png)

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [12월 15, 2024, 6:52오전 UTC](https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476/2 "2024-12-15T06:52:27Z")

</div>

이런 질문에는 항상 [https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576을](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576%EC%9D%84) 참고합니다.

---

<div class="post-metadata">

### Author: ![MihirR](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mihirr/32/475158_2.png) [@MihirR](https://meta.discourse.org/u/MihirR)
#### Post date: [12월 15, 2024, 1:01오후 UTC](https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476/3 "2024-12-15T13:01:46Z")

</div>

제가 아는 한, 스크립트로 카테고리를 생성하고 계신 것이라면 JSON을 사용하여 카테고리를 추가하는 것으로 추정됩니다. 이 경우 엔드포인트와 스크립트에 몇 가지 변경 사항이 필요합니다. 또한 이 문서를 참고할 수 있습니다: [Discourse Categories API](https://docs.discourse.org/#tag/Categories).

다만, Discourse는 매우 강력한 도구입니다. 이 가이드를 확인해 보세요: [Reverse Engineering the Discourse API](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576). Discourse는 완전한 JSON API를 기반으로 하므로, 이를 역설계하고 필요한 수정을 가한 뒤 원하는 대로 작동하도록 할 수 있습니다.

간단한 힌트:

- UI에서 원하는 “Solved” 설정을 수동으로 변경해 보세요.
- 브라우저가 만든 네트워크 요청을 검사하여 정확한 API 엔드포인트, 요청 메서드(예: `PUT`), 페이로드를 식별하세요.

Python 스크립트에서는 다음과 같은 형태가 될 것입니다:

```plaintext
 payload = {
        "enable_solved": True # 이 부분을 조정하세요
    }

    response = requests.put(url, headers=headers, json=payload)
    if response.status_code == 200:
        print("카테고리가 업데이트되었습니다")
    else:
        print(f"실패: {response.status_code} - {response.text}")

update_category_settings(category_id=123)

```

P.S. 이 부분은 완전히 확신하지는 못하지만, 최근에 몇 가지 스크립트를 작성해 본 경험이 있어 지금까지 겪어본 경험에 기반하여 답변드립니다. 🙂

---

<div class="post-metadata">

### Author: ![Steve\_John](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steve_john/32/435022_2.png) [@Steve\_John](https://meta.discourse.org/u/Steve_John)
#### Post date: [12월 17, 2024, 12:55오전 UTC](https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476/4 "2024-12-17T00:55:41Z")

</div>

미히르 씨, 감사합니다. 이 문제를 해결하는 데 도움이 되었습니다. 조언과 제안을 진심으로 감사드립니다.

---

<div class="post-metadata">

### Author: ![Steve\_John](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steve_john/32/435022_2.png) [@Steve\_John](https://meta.discourse.org/u/Steve_John)
#### Post date: [12월 17, 2024, 12:56오전 UTC](https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476/5 "2024-12-17T00:56:07Z")

</div>

Thomas님, 이 접근법을 알려주셔서 감사합니다.

---

<div class="post-metadata">

### Author: ![MihirR](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mihirr/32/475158_2.png) [@MihirR](https://meta.discourse.org/u/MihirR)
#### Post date: [12월 17, 2024, 5:10오전 UTC](https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476/6 "2024-12-17T05:10:08Z")

</div>

도움이 되셨다니 기쁩니다 🙂
