Refactor routes

Changes and refactorings in write api routes:

- return 404 if the bucket is invalid (because the bucket name is part of the url), both for json post and csv upload
- return 405 for a GET request to a bucket
- bucket validation implemented as function decorator