Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds Python code examples to the Swagger API documentation to help OED users understand how to interact with the hosted API. The changes enhance the existing docstrings with practical Python examples that demonstrate how to call the API endpoints using the requests library.
- Added comprehensive Python examples to the
/api/v1/dataendpoint showing both JSON and CSV data retrieval - Added Python examples to the
/api/v1/metadataendpoint for querying distinct column values - Enhanced the main API description with usage instructions for the Swagger interface
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/routers/data.py | Added detailed Python examples for JSON and CSV data retrieval with filtering |
| app/routers/metadata.py | Added Python example for querying metadata column values |
| app/main.py | Enhanced API description with Swagger usage instructions |
Contributor
Author
|
BTW, the purple code is a swagger default that's something of a hassle to override. |
|
Thanks @matthewberry! No worries about the purple code hahaha ... the examples look similar to examples for REST APIs/SOAP APIs I've used before for BRENDA and other DBs so I think this type of example will be quite useful for computational biologists. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We'd like OED users to have access to sample python code for calling the API.
There are currently nice examples in the README file, but the README file is written for people who are cloning this repo and running it locally. We expect many OED users would rather use the hosted API.
This PR therefore adds python examples to the swagger page. Screenshots are below.
Ideally we'd DRY this up, but we need a very quick solution for this week.