how to modify the "Hide from lists and menus" property using REST API
- 14 years ago
Hi Vijay,
For each node (category, board, blog, etc) in the community, you can use the "settings" method to obtain a list of all the settings for that node. If you're having a look at the list via your browser, you may want to bump the page size up to 1000. Even at that size, you'll still have a couple of pages to browse through.
Here are some sample calls depending on the type of node:
- Community - /restapi/vc/settings?page_size=1000&page=1
- Category (category id news in this example) - /restapi/vc/categories/id/news/settings?page_size=1000&page=1
- Board (board id test in this example) - /restapi/vc/boards/id/test/settings?page_size=1000&page=1
Once you know the name of the setting you're interested in, you can use the methods available in the Settings class to access or modify it directly.
To obtain the value of a setting, use the method: name/<setting name>
For example, /restapi/vc/settings/name/<setting name>
To set the value of a setting, use the method: name/<setting name>/set
For example, /restapi/vc/settings/name/<setting name>/set
Now as for the particular settings you're interested in, I believe these are the setting names you're looking for:
- "Title" - category.title (note, the setting name would be different if you were accessing at the community or board level)
- "Short Title" - category.title_short (note, the setting name would be different if you were accessing at the community or board level)
- "Description" - category.description (note, the setting name would be different if you were accessing at the community or board level)
- "Keywords" - category.keywords (note, the setting name would be different if you were accessing at the community or board level)
- "Make all posts read-only" - config.read_only
- "Hide from Lists and Menus" - config.hidden
A quick tip, you can often glean some relevant info about back-end setting names by taking a look at the text keys for those settings in the UI. For example, if you switch on the "Show text keys" mode of Studio and look at the same page in the admin, you'll see this something that looks like the image below. I've highlighted the setting names so it's easier to see what I'm talking about.
So if you were interested in setting the settings for the community level or for a board, you could switch on "Show text keys" and browse to the proper page in the admin to confirm the settings for those.
I hope this helps!