-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Welcome to the mongo-web-filesystem wiki!
HTTP header: Content-Type must be set to the file's mime type.
POST http://hostname:port/webfs/v1.0/tenant?name=fileName&owner=lid:aim:entityname/id&tags=tag1&tags=tag2%references=ref1&references=ref2&classifier=SomeType
Query parameters are:
- name - file name
- owner - owner URI
- references - reference uri (may repeat)
- tags - tags (may repeat)
- classifier - a file classification type
- uploadedBy - cannot be set, taken from security principal.
- updatedBy - cannot be set, take from security principal. Always null on POST.
- md5 - cannot be set, it is calculated from the input.
- uploadDate - cannot be set, defaults to the date/time of insert.
- id - cannot be set - generated by the database.
- note - a note for the file
Response is the id of the inserted file.
curl --form "upload=@filename;type=mime/type" \
--form name="nameInDb" \
--form tags="props" \
--form tags="text" \
--form "owner=lid:aim:patient:111" \
http://localhost:8080/webfs/v1.0/ACME
Response code:
- 201 - file created successfully
- 409 - file not created because of validation errors
GET http://hostname:port/webfs/v1.0/tenant/id
curl -i http://localhost:8080/webfs/v1.0/ACME/ID
Response is file content, with the response Content-Type HTTP Header set to the file mime type. The Content-Disposition HTTP header contains the file name and indicates the content is an attachment.
The HTTP headers whose names begin with WEBFS are set from the file metadata. That includes the file id, name, MD5, uploadDate, tenant, owner, references, tags, note. Here is the exact list of WEBFS headers:
- WEBFS.ID - document id
- WEBFS.NAME - file name
- WEBFS.SIZE - file size in bytes
- WEBFS.MD5 - file MD5 checksum
- WEBFS.UPLOAD_DATE -
- WEBFS.TENANT -
- WEBFS.UPLOADED_BY - optional
- WEBFS.MODIFIED_BY - optional
- WEBFS.CLASSIFIER - optional
- WEBFS.OWNER - optional
- WEBFS.REFERENCES - optional, this header may repeat
- WEBFS.TAGS - optional, this header may repeat
- WEBFS.NOTE - optional, the file note
Response codes:
- 200 - success
- 403 - user is not authorized to access the file
- 404 - file was not found
PUT http://hostname:port/webfs/v1.0/tenant/id?param=value[¶m=value]*
curl -X PUT --data "classifier=PATIENT%20DATA&tags=tag1&tags=tag2" \
http://localhost:8080/webfs/v1.0/ACME/4fb2e5d24e0857617f9bb2ae
Response is the id of the file if the request was successful. Response code:
- 200 - file created successfully
- 403 - user is not authorized to access the file
- 404 - file was not found
- 409 - file not created because of validation errors
The following parameters may be set:
- name - file name
- owner - ownder URI
- references - reference uri (may repeat)
- tags - tags (may repeat)
- classifier - a file classification type
- note - a note for the file
The content of the file cannot be updated. To update the content of a file, remove the existing file and insert the updated file.
ALB: Why is the file content not updated? DJL: Because the metadata will no longer match the content, and versioning is lost. It is currently possible to store multiple versions of the same document (same tenant, owner and file name). At this point the _id field is used to distinguish the versions. It should also be noted that you can delete just a single version of the file by using the correct ID. This was all part of the original specs.
DELETE http://host:port/webfs/v1.0/tenant/id
curl -X DELETE http://localhost:8080/webfs/v1.0/tenant/id
Deletes the specified file.
Response codes:
- 200 - removed successfully
- 403 - user is not authorized to access the file
- 404 - file was not found