goci
goci copied to clipboard
Implement an Endpoint to Update File Types
Description:
There are scenarios where curators need to update the file type for all studies in a submission or for a specific GCST ID. This requires the creation of a new endpoint in the gwas-sumstats-service
that allows curators to send a request via curl
to update file types and regenerate the corresponding YAML metadata.
Acceptance Criteria:
- A new endpoint is implemented in the
gwas-sumstats-service
to handle file type updates. - The endpoint accepts a request to update file types for:
- All studies in a submission.
- A specific study identified by its GCST ID.
- The endpoint regenerates the YAML metadata for the affected studies after updating the file types.
- The endpoint is accessible via
curl
and returns appropriate responses (e.g., success, failure, or validation errors). - Proper error handling is implemented for invalid requests or missing data.
- Documentation is updated to include usage examples for the new endpoint.
Proposed Endpoint:
-
Method:
POST
-
Path:
/v1/update-file-type
-
Request Body:
{ "submission_id": "optional_submission_id", "gcst_id": "optional_gcst_id", "new_file_type": "new_file_type_value" }
-
Response:
- Success:
200 OK
with a message confirming the update and metadata regeneration. - Failure:
400 Bad Request
or404 Not Found
with an error message.
- Success:
Example Curl Request:
curl -X POST "gwas-ss-service:8000/v1/update-file-type" \
-H "Content-Type: application/json" \
-d '{
"submission_id": "SUB12345",
"new_file_type": "updated_file_type"
}'