REST: copypasted code moved to macros