Implement relation REST API, fixes #8.