I think that API method that return sometime HTML and sometime JSON (even if exactly same params are passed) is a sort of hacky solution. I understand urgency of the task behind this pull request and I don't think it should not get merged because of that - what I suggest is creating a technical debt ticket. Let me know guys if you agree and I will create one.