I create topics and categories through API. When I create a category, “about the ***” topic is created automatically but I want to “unlist” it so user should not be able to see it. any suggestions on how I can do this ??
AI-generated summary
In a discussion about automatically unlisting “About the ***” topics created when a new category is made via API, Ravi_Teja_Varma sought a way to hide these topics from users. pfaffman suggested using the API to unlist the topic after creation, noting that the topic ID should be available in the category response. Ravi_Teja_Varma initially didn’t find the topic ID in the API response, sharing a sample output. pfaffman pointed out that the topic ID is embedded in the topic_url field (e.g., /t/about-the-free-test-api-1-auto-category/82133 — the number 82133 is the topic ID). Ravi_Teja_Varma confirmed this solution worked. The key takeaway is that while the topic ID isn’t directly named in the category object, it can be extracted from the topic_url to perform API actions like unlisting.
Use the API. You’d get the topic ID from when you create the topic and then unlist it. See How to reverse engineer the Discourse API to see how to unlist it.
I don’t have the topic ID as it is automatically created by discourse when I create a category.
I believe they the topic id of the about topic is in the category record that gets returned when you create the category.
This is a sample response and I did not find any “topic_id”, can you help me here @pfaffman
{
"category": {
"id": 68,
"name": "FREE TEST API 1 AUTO",
"color": "0088CC",
"text_color": "FFFFFF",
"slug": "free-test-api-1-auto",
"topic_count": 0,
"post_count": 0,
"position": 67,
"description": null,
"description_text": null,
"description_excerpt": null,
"topic_url": "/t/about-the-free-test-api-1-auto-category/82133",
"read_restricted": false,
"permission": null,
"notification_level": 1,
"can_edit": true,
"topic_template": null,
"has_children": null,
"sort_order": null,
"sort_ascending": null,
"show_subcategory_list": false,
"num_featured_topics": 3,
"default_view": null,
"subcategory_list_style": "rows_with_featured_topics",
"default_top_period": "all",
"default_list_filter": "all",
"minimum_required_tags": 0,
"navigate_to_first_post_after_read": false,
"custom_fields": {},
"min_tags_from_required_group": 1,
"required_tag_group_name": null,
"read_only_banner": null,
"available_groups": [
"admins"
],
"auto_close_hours": null,
"auto_close_based_on_last_post": false,
"group_permissions": [
{
"permission_type": 1,
"group_name": "everyone"
}
],
"email_in": null,
"email_in_allow_strangers": false,
"mailinglist_mirror": false,
"all_topics_wiki": false,
"can_delete": true,
"cannot_delete_reason": null,
"allow_badges": true,
"topic_featured_link_allowed": true,
"search_priority": 0,
"uploaded_logo": null,
"uploaded_background": null
}
}
I think this is what you’re looking for:
Thanks, it worked @pfaffman