# How to enable this field - "Solved" - programatically for each category

**URL:** https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476
**Category:** Support
**Created:** [December 15, 2024, 1:35am 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:** 1
**Showing post:** 3

<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: [December 15, 2024, 1:01pm UTC](https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476/3 "2024-12-15T13:01:46Z")

</div>

From what I know, if you are building categories with a script, I assume you are using JSON to add the categories. You would have to make some changes to the endpoint and the script. You can also refer to this documentation: [Discourse Categories API](https://docs.discourse.org/#tag/Categories).

However, Discourse is a powerful tool. You can check out this guide: [Reverse Engineering the Discourse API](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576). Since Discourse is backed by a complete JSON API, you can reverse engineer it, make the necessary alterations, and get it to work as needed.

A quick hint:

- Change the desired “Solved” setting manually in the UI.
- Inspect the network requests made by the browser to identify the exact API endpoint, request method (e.g., `PUT`), and payload.

In python script it would look something like this:

```plaintext
 payload = {
        "enable_solved": True # Adjust this
    }

    response = requests.put(url, headers=headers, json=payload)
    if response.status_code == 200:
        print("Category updated")
    else:
        print(f"Failed: {response.status_code} - {response.text}")

update_category_settings(category_id=123)

```

PS: I’m not entirely sure about this, but I recently built some scripts, so this response is based on the things I have come across so far. 🙂

---

_[View the full topic](https://meta.discourse.org/t/how-to-enable-this-field-solved-programatically-for-each-category/342476)._
