Add api_get test.
Fix bugs uncovered.
Add sinon as a dev dependency.