DHIS2: Moved API stuff into API class.

Also added settings and a very slow functional test

TODO: Add mocked-out unit tests and remove functional test