Merge pull request #917 from thingthing/3.2-A4109

Refactor API (closes #4110 closes #4109)
Escape " in docid label (refs #4094)