API Testing Guide

Learn how to test and interact with the Mycology Research Pipeline API using Postman or similar tools.

Getting Started with Postman

Postman is a popular API client that makes it easy to test and document APIs. Follow these steps to get started testing the Mycology Research Pipeline API:

  1. Download and install Postman

    Visit https://www.postman.com/downloads/ to download and install Postman for your operating system.

  2. Create a new Collection

    In Postman, create a new Collection called "Mycology Research Pipeline API".

  3. Set up your environment

    Create a new Environment with the following variables:

    • base_url: http://localhost:8000 (or your deployed API URL)
  4. Create your first request

    Create a new GET request to check the API health status:

    • URL: /api/health
    • Method: GET
Tip: You can import the complete Postman Collection using the button below.
API Endpoints
Endpoint Method Description Action
/api/health GET Check API health status
/api/samples GET Get a list of samples
/api/samples/{id} GET Get a specific sample by ID
/api/samples POST Create a new sample
/api/analysis GET Get a list of analyses
/api/analysis/{id} GET Get a specific analysis by ID
/api/process POST Process data for analysis
/api/batch GET Get a list of batch jobs
/api/batch/{id} GET Get a specific batch job by ID
/api/batch POST Create a new batch job
Example API Requests

Request headers:

Content-Type: application/json

Request body:

{
  "name": "Turkey-Tail-001",
  "species": "Trametes versicolor",
  "description": "Wild-harvested Turkey Tail specimen from mixed forest",
  "location": "Oregon, Mixed Conifer Forest",
  "collection_date": "2025-05-01T10:00:00Z",
  "sample_metadata": {
    "substrate": "Dead oak log",
    "weather_conditions": "Partly cloudy, high humidity",
    "forest_type": "Mixed conifer-deciduous",
    "collector": "M. Crowe"
  }
}

cURL example:

curl -X POST "https://mycologyhub.com/api/samples" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Turkey-Tail-001",
       "species": "Trametes versicolor",
       "description": "Wild-harvested Turkey Tail specimen from mixed forest",
       "location": "Oregon, Mixed Conifer Forest",
       "collection_date": "2025-05-01T10:00:00Z",
       "sample_metadata": {
         "substrate": "Dead oak log",
         "weather_conditions": "Partly cloudy, high humidity",
         "forest_type": "Mixed conifer-deciduous",
         "collector": "M. Crowe"
       }
     }'

Request headers:

Content-Type: application/json

Request body:

{
  "input_data": "sample:1",
  "parameters": {
    "analysis_type": "bioactivity_analysis",
    "target_compounds": ["Ganoderic Acid A", "Beta-D-Glucan"],
    "reference_threshold": 0.75
  }
}

cURL example:

curl -X POST "https://mycologyhub.com/api/process" \
     -H "Content-Type: application/json" \
     -d '{
       "input_data": "sample:1",
       "parameters": {
         "analysis_type": "bioactivity_analysis",
         "target_compounds": ["Ganoderic Acid A", "Beta-D-Glucan"],
         "reference_threshold": 0.75
       }
     }'

Request headers:

Content-Type: application/json

Request body:

{
  "name": "May 2025 Batch Analysis",
  "description": "Bioactivity analysis for all samples collected in May 2025",
  "input_file": "samples/may_2025.csv",
  "parameters": {
    "analysis_type": "bioactivity_analysis",
    "include_molecular_weight": true,
    "target_threshold": 0.7
  }
}

cURL example:

curl -X POST "https://mycologyhub.com/api/batch" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "May 2025 Batch Analysis",
       "description": "Bioactivity analysis for all samples collected in May 2025",
       "input_file": "samples/may_2025.csv",
       "parameters": {
         "analysis_type": "bioactivity_analysis",
         "include_molecular_weight": true,
         "target_threshold": 0.7
       }
     }'