Allow custom headers and remote endpoint to be specified at the same time when constructing Api

(But really most of this commit is messing around with all the different constructors)

Change-Id: I4b54b2368c0b6fe54b14ebf8f670305e5c6b94b7