Factor API interactions into services.
Add service tests.