Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Bruno API Collection

JHE ships a Bruno API collection for exercising the Admin and FHIR APIs by hand. Every request uses environment variables, so there are no hardcoded IDs.

WhatWhere (in the JHE repo)
Collection (Admin + FHIR requests)opencollection/JHE/
Token-minting commandcore/management/commands/create_bruno_app.py
Test that keeps the collection truetests/backend/test_bruno_collection.py

Setup

  1. Install Bruno.

  2. Seed the database and mint an access token:

    python manage.py seed
    python manage.py create_bruno_app --email admin@example.com

    create_bruno_app creates a public OAuth app, generates a 1-year access token, and makes the user a manager of every organization. Copy the printed token.

  3. In Bruno, choose Open Collection and select opencollection/JHE/.

  4. Create an environment and set the variables below. Get real IDs from the Web UI or your seeded data.

    VariableMeaning
    BASE_URLServer root, e.g. http://localhost:8000
    ACCESS_TOKENToken printed by create_bruno_app
    ORG_IDAn organization id
    PATIENT_IDA patient id
    STUDY_IDA study id
    USER_IDA user id
    DATA_SOURCE_IDA data source id
    CLIENT_APP_IDAn OAuth client (JheClient) id
  5. Select the environment, then send any request.

The token expires after one year. Re-run create_bruno_app to mint a new one.

Collection structure

FolderCovers
AdminOrganizations, Patients, Studies, Users, Practitioners, Data Sources, Clients, Settings, Observations
FHIRFHIR R5 Patient, Observation (filtered search + _summary=count), and QuestionnaireResponse endpoints

Keeping it in sync

test_bruno_collection.py parses every request and fires it against the API, so any request that drifts from the real endpoints fails the backend test suite. Run it with the normal backend tests.