Fixes document creation from API call.

Adds missing validation to some of the JSSON fields.
Fixes comment attribute still based on an older JSON definition.
Fixes typo causing mimetype to be sent instead of file extension.