Bulk update all spaces settings

I’m looking for a method to bulk manage the ‘configure sidebar’ settings via API.
Our instance has >1000 spaces and we want to unify the content of the sidebar by removing e.g. the blog shortcut and setting the default navigation display option to ‘page tree’.
I’ve checked spaceManager and space in the Javadocs to no avail.