extract mars api to simplify writing end2end tests