def put(self): """ Remove the last element in the List identified by key, and return that element. This endpoint will update a List based the body that is posted """ check_content_type('application/json') app.logger.info('Payload = %s', api.payload) item = List.pop(api.payload) return item, status.HTTP_200_OK
def post(self): """ Append a String value to the end of the List identified by key This endpoint will create a List based the data in the body that is posted """ check_content_type('application/json') app.logger.info('Payload = %s', api.payload) list = List.append(api.payload) app.logger.info('List with new key [%s] saved!', list.key) return list.serialize(), status.HTTP_201_CREATED
def post(self): """ Instantiate or overwrite a Map identified by key with value value This endpoint will create a Map based the data in the body that is posted """ check_content_type('application/json') map_object = Map() app.logger.info('Payload = %s', api.payload) map_object.deserialize(api.payload) map_object.save() app.logger.info('Map with new key [%s] saved!', map_object.key) return map_object.serialize(), status.HTTP_201_CREATED
def post(self): """ Instantiate or overwrite a String identified by key with value value This endpoint will create a String based the data in the body that is posted """ check_content_type('application/json') string = String() app.logger.info('Payload = %s', api.payload) string.deserialize(api.payload) string.save() app.logger.info('String with new key [%s] saved!', string.key) # location_url = api.url_for(PetResource, key=string.key, _external=True) # return string.serialize(), status.HTTP_201_CREATED, {'Location': location_url} return string.serialize(), status.HTTP_201_CREATED
def put(self, key): """ Update the Map identified by key This endpoint will update a Map based the body that is posted """ app.logger.info('Request to Update a map_object with key [%s]', key) check_content_type('application/json') map_object = Map.get_value_with_key(key) if not map_object: # api.abort(404, "Map with key '{}' was not found.".format(key)) raise NotFound('Map with key [{}] was not found.'.format(key)) # data = request.get_json() data = api.payload app.logger.info(data) map_object.deserialize(data) map_object.key = key map_object.save() return map_object.serialize(), status.HTTP_200_OK
def put(self, key): """ Update the List identified by key This endpoint will update a List based the body that is posted """ app.logger.info('Request to Update a list with key [%s]', key) check_content_type('application/json') list = List.find(key) if not list: # api.abort(404, "List with key '{}' was not found.".format(key)) raise NotFound('List with key [{}] was not found.'.format(key)) # data = request.get_json() data = api.payload app.logger.info(data) list.deserialize(data) list.key = key list.save() return list.serialize(), status.HTTP_200_OK
def put(self, key): """ Update the value of the String identified by key This endpoint will update a String based the body that is posted """ app.logger.info('Request to Update a string with key [%s]', key) check_content_type('application/json') string = String.find(key) if not string: # api.abort(404, "String with key '{}' was not found.".format(key)) raise NotFound('String with key [{}] was not found.'.format(key)) # data = request.get_json() data = api.payload app.logger.info(data) string.deserialize(data) string.key = key string.save() return string.serialize(), status.HTTP_200_OK