modified rest API and tests for scenarios