def post(self): parser = reqparse.RequestParser() parser.add_argument('customer',type=dict) args = parser.parse_args().customer print "Customer POST: "+str(args) name = args['name'] users = wrappers.getDoc('user',args.get('users',[])) datasets = wrappers.getDoc('dataset', args.get('datasets',[])) customer = wrappers.createCustomer(name,datasets=datasets,users=users) return {'customer':fixKey(customer.to_json())},200
def put(self,uid): parser = reqparse.RequestParser() parser.add_argument('customer',type=dict) args = parser.parse_args().customer print "Customer PUT: "+str(args) customer = wrappers.getDoc('customer',uid) for k,v in args.iteritems(): if wrappers.getDoc(k,v) is not None: customer[k] = wrappers.getDoc(k,v) else: customer[k] = v customer.save() return {'customer':fixKey(customer.to_json())},200
def put(self,uid): parser = reqparse.RequestParser() parser.add_argument('dataset',type=dict) args = parser.parse_args().dataset print "Dataset PUT: "+str(args) dataset = wrappers.getDoc('dataset',uid) for k,v in args.iteritems(): if wrappers.getDoc(k,v) is not None: dataset[k] = wrappers.getDoc(k,v) else: dataset[k] = v dataset.save() return {'dataset':fixKey(dataset.to_json())},200
def post(self): parser = reqparse.RequestParser() parser.add_argument('entry',type=dict) args = parser.parse_args().entry print "Entry POST"+str(args) user = wrappers.getDoc('user',args['user']) dataset = wrappers.getDoc('dataset',args['dataset']) contents = args['contents'] if type(args['contents']) is dict else [args['contents']] try: entry = wrappers.createEntry(user,dataset,contents) return {'entry': fixKey(entry.to_json())},200 except ValueError as e: return {'err': e.message}, 403 return {'entry': fixKey(entry.to_json())},200
def post(self): parser = reqparse.RequestParser() parser.add_argument('user',type=dict) args = parser.parse_args().user print "User POST: "+str(args) newUser = wrappers.createUser(args['username'],args['name'],customers = wrappers.getDoc('customers',args['customers']), datasets = wrappers.getDoc('datasets',args['datasets'])) return {'user': fixKey(newUser.to_json())},200
def post(self): parser = reqparse.RequestParser() parser.add_argument('dataset',type=dict) args = parser.parse_args().dataset print "Dataset POST: "+str(args) customer = wrappers.getDoc('customer',args['customer']) dataset = wrappers.createDataset(customer,args['title']) return {'dataset':fixKey(dataset.to_json())},200
def post(self): parser = reqparse.RequestParser() parser.add_argument('datasetColumn',type=dict) args = parser.parse_args()['datasetColumn'] print "DatasetColumn POST: "+str(args) dataset = wrappers.getDoc('dataset',args['dataset']) datasetColumn = wrappers.setDatasetSchemaColumn(dataset,args['order'],args['name'],args['expected']) return {'datasetColumn':fixKey(datasetColumn.to_json())},200