Trying to figure out how to make a put request ot update the group_permissions/permissions not sure which one.
Essentially trying to make a category read only. So user can only just see and reply to posts already created.
Looking at the source it seems the category controller only allows the permissions
value as apposed to the group_permissions
.
I have tired the following - I’m even getting an error it’s just spitting out the category as it was.
data = json.dumps([{'group_name':'admin','permission_type':1},{'group_name':'everyone','permission_type':2}])
params_for_update_cat = {
'api_key': API_KEY,
'api_username':"MarketDiscuss",
"name": name_and_ticker,
"color": bg_colour,
"text_color": text_color,
"permission": json.dumps({'group_name':'everyone','permission_type':2}) #tried
}
#tried this too
"permission[]": [{'group_name':'admin','permission_type':1},{'group_name':'everyone','permission_type':2}]
#also tried this:
"permission": [{'group_name':'admin','permission_type':1},{'group_name':'everyone','permission_type':2}]
update_cat_url = f'{BASE_URL}/categories/{cat_id}'
ra = rq.put(url=update_cat_url, params=params_for_update_cat)
print(ra.url)
http://mydomainnnnn.com/categories/49?api_key=scrubbed&api_username=ausername&name=Royal+Bank+of+Scotland+-+%28RBS%29&color=8B1D7B&text_color=FFFFFF&permission=%7B%22group_name%22%3A+%22everyone%22%2C+%22permission_type%22%3A+2%7D
print(ra.content)
b'{"success":"OK","category":{"id":49,"name":"Royal Bank of Scotland - (RBS)","color":"8B1D7B","text_color":"FFFFFF","slug":"rbs","topic_count":0,"post_count":0,"position":9,"description":null,"description_text":null,"topic_url":"/t/about-the-royal-bank-of-scotland-rbs-category/65","read_restricted":false,"permission":null,"parent_category_id":9,"notification_level":null,"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","available_groups":["admins","everyone","moderators","staff","trust_level_0","trust_level_1","trust_level_2","trust_level_3","trust_level_4"],"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,"suppress_from_latest":false,"all_topics_wiki":false,"can_delete":true,"cannot_delete_reason":null,"allow_badges":true,"custom_fields":{},"allowed_tags":[],"allowed_tag_groups":[],"topic_featured_link_allowed":true,"uploaded_logo":null,"uploaded_background":null}}'
I also tried updating:
"read_restricted": True # in the request params
and it just stays false
, is there any de-facto list of values I can or can’t update for the api requests? I don’t see anything in the docs.
Any help would be awesome thanks