Add API endpoint tests.

Fixes #13.