Gallery 3 REST API client in JavaScript