Add support for flat_settings flag to all REST APIs that output settings

Closes #4140