refactoring a bit generic API views
fixed typo, tests passing