A reimplementation of the upload API with fastapi
This is related to #408 (closed) and https://github.com/nomad-coe/nomad/issues/1
endpoint | description | in | out | |
---|---|---|---|---|
GET | uploads | retrieve list of uploads | owner, modified since, pagination, processing filters, required | upload metadata (JSON) |
GET | uploads/id
|
retrieve upload metadata | required | upload metadata (JSON) |
GET | uploads/id /entries |
retrieve list of upload entries | pagination, modified since, processing filters, required | entry processing metadata (JSON) |
GET | uploads/id /entries/id
|
retrieve entry | required | entry processing metadata (JSON) |
GET | uploads/id /mirror |
stream upload and entry mongodb records | pagination, modified since | new line separated JSON docs |
POST | upload | created upload | name, auth | upload metadata (JSON) |
POST | upload/id /raw/upload |
upload and overwrite raw files | file archive | human readable acknowledgement or JSON depending on header |
GET | upload/id /raw/download/path
|
stream recursive contents as .zip | - | * or .zip depending on path |
POST | upload/id /raw/path
|
upload and overwrite a specific file, dirs are created | a file | human readable acknowledgement or JSON depending on header |
GET | upload/id /raw/path
|
retrieve directory contents or file | (JSON or HTML depending on header) or file depending on path (think HTTP file-server) | |
POST | upload/id /action |
trigger an action | reprocess, publish | upload metadata (JSON) |
POST | upload/id
|
edit upload metadata | name | upload metadata (JSON) |
DELETE | upload/id
|
delete | upload metadata (JSON) |
- implement this in
nomad.app.v1.routers.uploads
- mimic/use the models and principles in
nomad.app.v1.routers.entries
- the major differences with
nomad.app.v1.routers.entries
are: its about the processing data (nomad.processing.*
), not the entries metadata (nomad.datamodel.*
). Respectively, it's about using mongo and not elasticsearch. - start "duplicating" the functionality of the existing API
nomad.app.flask.api.upload.py
- after this
mirror
should get priority (data synchronization with NOMAD Oasis) - returning un-modeled JSON-fied version of the mongoengine objects (
nomad.processing.*
) should be enough in the beginning, only use modeling for the outer shell (pagination, etc.) - apply excessive testing, one method per endpoint, lots of parametrisation, reuse example data from entries test