Initial commit of API code

Initial commit of API code - tests to follow shortly