def update(id): print("Acces a /bucket/id avec POST") try: if request.headers['Content-Type'] != 'application/json': response = { "error": 1, "message": "Content-Type is not application/json" } return (response, 400) elif request.is_json: return BucketController.update(request) else: raise Exception() except Exception as e: print("ERROR: Request is not JSON or has missing fields.") response = {"error": 1, "message": "Missing fields in JSON"} print(response) return (response, 404)
def create(): """ POST => /buckets Recoit les informations pour enregistrer un nouveau bucket """ print("Acces a /bucket avec POST") try: if request.headers['Content-Type'] != 'application/json': response = { "error": 1, "message": "Content-Type is not application/json" } return (response, 400) elif request.is_json: return BucketController.create(request) else: raise Exception() except Exception as e: print("ERROR: Request is not JSON or has missing fields.") print(e) response = {"error": 1, "message": "Missing fields in JSON"} return (response, 404)
def id(id): """ GET => /buckets/id Renvoie un bucket spécifique. """ return BucketController.get(id)
def index(): """ GET => /buckets Envoie la liste des buckets. """ return BucketController.index()
def delete(id): """ DELETE => /buckets/id Supprime un bucket """ return BucketController.delete(id)
def id(id): return BucketController.get(id)
def index(): return BucketController.index()
def delete(id): return BucketController.delete(id)