var Doc = Backbone.Model.extend({ defaults: { api_token: null, dockey: null, dbkey: null }, initialize: function(){ var session = new Session(); this.set('api_token', session.getApiKey()) }, methodUrl: { 'read': '/rc/v1/system/license' }, sync: function(method, model, options) { if (model.methodUrl && model.methodUrl[method.toLowerCase()]) { options = options || {}; options.url = model.methodUrl[method.toLowerCase()]; options.token = this.get('api_token') } Backbone.sync(method, model, options); }, get_doc: function(dbkey,d_type){ self = this; var session = new Session(); this.set('dbkey',dbkey); $.ajax({ type: 'GET', url: '/rc/v1/store/' + dbkey, beforeSend: function (HttpRequest) { HttpRequest.setRequestHeader("X-RhoConnect-API-TOKEN", session.getApiKey()); }, success: function(resp){ var data = "" r = self.formatJson(resp) if(resp != ''){ data += "
" + r+ "