Unable to update Category Setting thru API

Hello, we’ve been working on a tool to create categories using a CSV input. We were able to successfully establish the parent-child relationships while creating the categories. However, we’re encountering issues when it comes to applying category settings—it consistently fails. Any guidance on how to apply category settings (like the ones listed below) after creating a new category would be appreciated. We’ve even tried adding a delay of up to 40 seconds before applying the settings, but it’s still not working.

Also want to Update Category Description :: update_about_post(category_id, description) # Update description only.

Also I wanted to add two additional custom field for Category , how to add this .

Function to update the category settings

def update_category_settings(category_id):
time.sleep(5) # Add a delay to ensure the category is fully created before applying settings

url = f"{DISCOURSE_URL}/categories/{category_id}"
data = {
    "subcategory_list_style": "boxes",  # Set subcategory style to "Boxes"
    "show_subcategory_list": True,  # Show subcategory list above topics
    "allow_solved_on_category": True  # Enable solved feature
}

response = requests.put(url, json={"category": data}, headers=headers)

if response.status_code == 200:
    print(f"Category settings updated for category ID {category_id}")
else:
    print(f"Failed to update settings for category ID {category_id}: {response.status_code}, {response.text}")