Write to content API

This is #2713 in the new JSON format that has been agreed.

@nicl