move HTTP handling into .api helper classes