我看到有关于通过 API 设置 notification_level 的讨论。那么读取值呢?
例如,我可以用以下方式设置一个值:
PUT {{base_url}}/category/14/notifications.json?api_key={{api_key}}&api_username={{api_username}}¬ification_level=3
如何读取相同的值?
我看到有关于通过 API 设置 notification_level 的讨论。那么读取值呢?
例如,我可以用以下方式设置一个值:
PUT {{base_url}}/category/14/notifications.json?api_key={{api_key}}&api_username={{api_username}}¬ification_level=3
如何读取相同的值?
Have a look at How to reverse engineer the Discourse API visit your profile page on the tab that shows it, its in one of the user json payloads.
Normally reversing out the API has worked for me, but for some reason this time I don’t see it.
From a user’s profile page (/u/user_name/summary) I see the /u/user_name/summary.json payload, but don’t see anything in there about notification_level’s there.
Clicking on the Preferences tab loads /user-badges/user_name.json, also no notification_level.
Clicking on Categories does not seem to load any json payload.
Reloading the page from /u/km_admin/preferences/categories loads \u\user_name.json. That one has all the group notification_level settings, but nothing about category settings.
The user’s category notification level is also accessed by Discourse at \c\category_name, but I don’t see it returned there either, unless it’s called something without the string notific … in it, as all I’m seeing returned there are notification levels for each returned topic.
Safe to assume the content.css, mini-profiler results, and poll payloads can be ignored?
A GET to https://meta.discourse.org/categories.json contains:
{
"category_list": {
"categories": [
{
"notification_level": 1,
...
},
]
}
}
It finally occurred to me: /categories.json > notification_level is for the logged in user.
I took that to be the default notification_level for the category, which of course categories don’t have.
Thanks, @Falco!
So … by this approach, that means getting a given user’s /categories.json > notification_level requires this update to the client object?
client.api_username = @each_users_username
One cannot just do something like so without changing the client.api_username value?:
client.categories(api_username=@users_username)