Rename lib.api to lib.endpoint
Add standard JSON stuff to api