exchange: refactor api
exchange: put resource codes in independent file