Fixed API v2 for Javascript clients (issue #3411)