Restjson cancel

Fixes #372.