HumanBrainProject / HumanBrainProject/hbp-validation-framework
REST API faults
Open
@apdavison is already working on this.
Since Mar 19, 2020.
REST API v2
- Dominant language
- Python
- Stars
- 5
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
I found the following problems with the REST APIs:
[ ] GET for models does not return 'license' and 'project' parameters- GET for tests does not return 'publication' and 'age' parameters
- GET /authorizedcollabparameterrest/ should also return values for other parameters like 'license' (model instances) and 'status' (tests)
- GET /authorizedcollabparameterrest/ should change key 'data_modalities' to 'data_modality' to align with regular usage
- EDIT for models returrns uri (e.g. {'uuid': 'https://nexus.humanbrainproject.org/v0/data/modelvalidation/simulation/modelproject/v0.1.0/bc38a55a-4134-438f-b98a-4fcd373912bc'}) whereas intended output is only UUID, as is with other APIs
- API error messages lack info for debugging. E.g. for duplicate test alias while creating test, we simply get: "Exception: Error in adding test. Response = <Response [400]>"
- POST for tests sets 'cell_type' to 'Not applicable' when no value is specified (None); other params seem fine.
- when registering a model with all same parameters (no alias, same name), the API executes successfully, but returns the same UUID each time. Changing a parameter such as 'brain_region' doesn't change anything. But on changing the name, we get a new UUID.
- listing of all results via GET
https://validation-v1.brainsimulation.eu/results/?order=score_typefails (<h1>Server Error (500)</h1>); retrieving indiviual results still works e.g. GEThttps://validation-v1.brainsimulation.eu/results/?order=score_type&id=073151b6-dfbb-4015-a8ea-24a304c927ec - GET on indivudal results doesn't return parameters such as 'platform', 'hash', ' '.
- GET on tests seems to retrieve only 100 entries
- GET on models returns output with keys: ["models", "page", "total_models", "total_nb_pages"], while GET on tests returns output only with key: "tests"
- GET on invalid ID/alias works inconsistently for models, tests, results. Invalid model_id and test_id return errors, while model_alias, test_alias and result_id return empty lists.
- As part of new REST API changes, we should have POST on model creation (and tests) to return the entire JSON object (and not just the newly created UUIDs). The model instances UUIDs are unavailable in the current scenario and thus would demand an extra request for populating the model detail page immediately after creation. This would also help in other situations.
- POST on models takes an array of instances, whereas POST on tests can accept only a single instance. The instances for tests are named "codes" and should probably be named "instances" as in the case of models. The keys for JSON for POSTing to models and tests are also not consistent [(model, model_instance) vs (test_data, code_data)].
- POST on models accepts empty string ("") for fields such as species, whereas the same isn't accepted by POST on tests.
- decision needs to be taken (and subsequent implementation) on handling "images" under models. Do we retain them; move them to model instances; or have them for both?
- PUT on models has a different JSON requirement than PUT on tests. Former requires a key "models" and accept a list of dicts, whereas the latter only accepts a dict (no "tests" key or list).
Other API related tickets:
https://github.com/HumanBrainProject/hbp-validation-framework/labels/REST%20API
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.