A simple http API for remote FS
git clone https://github.com/mav96/SimpleHttpFS.git
cd SimpleHttpFS
virtualenv env -p python3
source env/bin/activate
pip install -r requirements.txt
python manage.py runserver
We can now access to remote FS using the httpie command line tool...
- /get Downloads a file:
http -a admin:password123 GET http://localhost:8000/get/readme.txt > readme.txt
Method GET
Returns: The specified file's contents
Errors: 404 The file wasn't found at the specified name
- /put Uploads a file using PUT semantics.
http -a admin:password123 PUT http://localhost:8000/put/readme.txt < readme.txt
Method PUT, POST
Returns: The metadata for the uploaded file.
Errors: 409 The call failed because a conflict occurred.
- /update Update file
http -a admin:password123 PUT http://localhost:8000/update/readme.txt < new_readme.txt
Method PUT, POST
Returns: The metadata for the uploaded file.
Errors: 404 The file wasn't found at the specified name
- /meta Retrieves file metadata.
http -a admin:password123 GET http://localhost:8000/meta/readme.txt
Method GET
Returns: The metadata for the file
Errors: 404 The file wasn't found at the specified name
- /ls List information about the FILEs
http -a admin:password123 GET http://localhost:8000/ls/
Method GET
Returns: List of metadata entries for any matching files
- /rm Deletes a file
http -a admin:password123 PUT http://localhost:8000/rm/readme.txt
Method PUT,POST
Returns: Metadata for the deleted file
Errors: 404 The file wasn't found at the specified name