Tidied up utility functions into a separate library, backed out workaround for rest_api call for APP_TYPE