Skip to content

Conversation

@matthewberry
Copy link
Contributor

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.

image image image

Ideally we'd DRY this up, but we need a very quick solution for this week.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/data endpoint showing both JSON and CSV data retrieval
  • Added Python examples to the /api/v1/metadata endpoint 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

@matthewberry
Copy link
Contributor Author

BTW, the purple code is a swagger default that's something of a hassle to override.

@matthewberry matthewberry merged commit 9b69b4f into main Aug 8, 2025
1 check passed
@David-Bianchi
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants