I\'m working on a web site that is using the Google JavaScript Client Library to load some APIs that are exposed via Google Cloud Endpoints. The endpoints were developed in Pyth
Hope it can help :
var executeRequest = function(path, data, callback, method){
var url = ‘YOUR_API_LINK' + path;
$.ajax({
url: url,
type: method,
dataType: 'json',
data: data?data:null,
success: function(data, status, xhr) {
},
error: function(xhr, status, error) {
},
complete: function(xhr, status) {
var data = null;
console.log('Request ' + url + ' completed');
if (xhr.responseText && xhr.responseText.length > 0) {
data = $.parseJSON(xhr.responseText);
}
if (callback)
callback(data);
}
});
};
---------------
Simple call example of this function made in the same file :
---------------
var simpleGetUser = function(userKey, callback){
this.executeRequest(
'/user/v1/user/' + userKey,
{/* If you got any parameters, put them here */},
function (res) {
if (callback)
callback(res);
}, 'GET');
};
Good luck !