Add a PUT endpoint
To solve the Solid-XMPP-Chat component file upload integration issue here we should implement a PUT endpoint following those specifications:
- The PUT and associated GET request should be of form: https://api.test1.startinblox.com/upload/ZunoEUC5kOakiiaVZfEKQlR8ZpR65IN-/cat.jpg
- Given that we do not know the exact upload URL in advance, every arbitrary PUT requests on
/upload/(.*)/filename.extension
should be accepted - We could:
- Generate a sub-directory using the given hash on every uploads
- Store the hash itself as an optional Field on the Document model and build dynamically the GET endpoint response upon request
My preference goes to the second option, it would avoid having to deal with hundreds of sub-directories when the applications grow...
For that:
- Add a hash field in the
models.py
- Add virtually build (using regex) endpoint in
djangoldp_urls.py
- Add the associated method in the
UploadFileView
inviews.py
- Modify or create a dedicated
upload
method capable of storing the proper information