openapi: 3.1.0
info:
  contact:
    email: ontoserver-support@csiro.au
    url: https://ontoserver.csiro.au/
  description: Various non-FHIR APIs for managing the operation of an Ontoserver instance
    including its Syndication feed.
  title: Ontoserver Management APIs
servers:
- description: CSIRO R4 Terminology Server Sandbox
  url: https://r4.ontoserver.csiro.au
- description: CSIRO Production Server
  url: https://tx.ontoserver.csiro.au
- description: Local server
  url: http://localhost:8080
tags:
- name: Admin
- name: Syndication
paths:
  /api/addBundle:
    post:
      description: Add a bundle of FHIR Resources to the server
      operationId: addBundleFile
      requestBody:
        content:
          application/fhir+json: {}
          application/fhir+xml: {}
          application/json: {}
          application/json+fhir: {}
          application/xml: {}
          application/xml+fhir: {}
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                  description: A FHIR Bundle object containing a set of resources
              required:
              - file
      responses:
        "200":
          content:
            application/json: {}
          description: OK
      tags:
      - Admin
  /api/auditReports:
    get:
      description: Get all current audit reports
      operationId: getAuditReports
      responses:
        "200":
          content:
            application/fhir+json:
              schema:
                type: string
            application/json:
              schema:
                type: string
          description: OK
      tags:
      - Admin
  /api/availableCodeSystemIndexes:
    get:
      description: Get a list of the code system indexes that are available to this
        server
      operationId: getAvailableCodeSystemIndexes
      responses:
        "200":
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AtomArtifact"
          description: OK
      tags:
      - Admin
  /api/availableCodeSystemSources:
    get:
      description: Get a list of the code system sources that are available to this
        server
      operationId: getAvailableCodeSystemSources
      responses:
        "200":
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AtomArtifact"
          description: OK
      tags:
      - Admin
  /api/codeSystems:
    get:
      description: Get a list of the code system sources that are loaded in this server
      operationId: getCodeSystemsInfo
      responses:
        "200":
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CodeSystemInfo"
          description: OK
      tags:
      - Admin
  /api/deleteCodeSystem:
    post:
      description: Remove a SNOMED/LOINC code system
      operationId: deleteCodeSystem
      parameters:
      - description: "A code system identifier, e.g. http://snomed.info/sct"
        in: query
        name: codeSystemId
        required: true
        schema:
          type: string
      - description: The version of the specified code system
        in: query
        name: codeSystemVersion
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
      tags:
      - Admin
  /api/indexCodeSystem:
    post:
      description: "Index a SNOMED/LOINC code system, using a syndication server if\
        \ available"
      operationId: indexCodeSystem
      parameters:
      - description: "A code system identifier, e.g. http://snomed.info/sct"
        in: query
        name: codeSystemId
        required: true
        schema:
          type: string
      - description: "The version (or optionally, for SNOMED, the Edition) of the\
          \ specified code system"
        in: query
        name: codeSystemVersion
        required: false
        schema:
          type: string
      - description: Indicates whether the server should validate the index if it
          already exists
        in: query
        name: validate
        required: true
        schema:
          type: boolean
      - description: "Do not use BINARY indexes from syndication feed, but build them\
          \ locally"
        in: query
        name: buildLocal
        required: false
        schema:
          type: boolean
          default: false
      responses:
        "200":
          content:
            '*/*':
              schema:
                type: string
          description: OK
      tags:
      - Admin
  /api/indexedCodeSystems:
    get:
      description: Get a list of the code systems that are indexed on this server
      operationId: getIndexedCodeSystems
      responses:
        "200":
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CodeSystemDetails"
          description: OK
      tags:
      - Admin
  /api/jobs:
    get:
      description: Retrieve a list of the background Jobs the server has run/is running
        along with their status
      operationId: getJobs
      parameters:
      - description: A job identifier
        in: query
        name: jobId
        required: false
        schema:
          type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                type: string
          description: OK
      security:
      - oauth2:
        - onto/api.read
      tags:
      - Admin
  /api/mode:
    get:
      description: Retrieve the security modes of Ontoserver
      operationId: mode
      responses:
        "200":
          content:
            application/json:
              schema:
                type: string
          description: OK
      security:
      - oauth2:
        - onto/api.read
      tags:
      - Admin
  /api/startupProbe:
    get:
      description: Returns startup status information.
      operationId: startupProbe
      parameters:
      - description: "Status property to check. One of: Live, Ready"
        in: query
        name: status
        required: true
        schema:
          type: string
          enum:
          - Live
          - Ready
      responses:
        "200":
          content:
            text/plain:
              schema:
                type: string
          description: Probed state is true
        "400":
          content:
            text/plain:
              schema:
                type: string
          description: Unknown state requested
        "503":
          content:
            text/plain:
              schema:
                type: string
          description: Probed state is false
      tags:
      - Admin
  /api/upstream.xml:
    get:
      description: Retrieve merged form of the server's upstream syndication feeds
        (if available)
      operationId: getUpstreamFeed
      responses:
        "200":
          content:
            application/atom+xml:
              schema:
                type: string
          description: OK
      tags:
      - Admin
  /api/vacuum:
    post:
      description: "Checks for, and optionally cleans up, extraneous indexing content\
        \ in the filesystem."
      operationId: vacuum
      parameters:
      - description: "If 'true', then actually delete the extraneous content"
        in: query
        name: cleanup
        required: false
        schema:
          type: boolean
          default: false
      - in: query
        name: verbose
        required: false
        schema:
          type: boolean
          default: false
      responses:
        "200":
          content:
            '*/*':
              schema:
                type: object
                additionalProperties: {}
          description: Success
        "500":
          content:
            '*/*':
              schema:
                type: object
                additionalProperties: {}
          description: Failure
      tags:
      - Admin
  /api/version:
    get:
      description: Retrieve the version of Ontoserver and HAPI
      operationId: version
      responses:
        "200":
          content:
            application/json:
              schema:
                type: string
          description: OK
      tags:
      - Admin
  /synd/fetchSyndicatedContentEntry:
    post:
      description: "Fetch an artifact from the upstream syndication feed into the\
        \ server. For entries of type Bundle: only 'batch' and 'collection' are supported.\
        \ Future versions may support 'transaction', and unsupported contained Resource\
        \ types will be ignored."
      operationId: fetchSyndicatedContentEntry
      parameters:
      - description: The atom entry ID to fetch
        in: query
        name: entryId
        required: false
        schema:
          type: string
      - description: The type of resource to fetch
        in: query
        name: resourceType
        required: false
        schema:
          type: string
      - description: "The URL of the resource (CodeSystem, ValueSet, ConceptMap or\
          \ StructureDefinition) to fetch"
        in: query
        name: url
        required: false
        schema:
          type: string
      - description: The version of the resource to fetch
        in: query
        name: version
        required: false
        schema:
          type: string
      - description: "If the entry is a Bundle, how to process the Bundle. Valid values\
          \ are: 'batch' and 'collection'"
        in: query
        name: bundleInterpretation
        required: false
        schema:
          type: string
      responses:
        default:
          content:
            application/fhir+json: {}
          description: default response
      tags:
      - Syndication
  /synd/getBinaryIndexZip:
    get:
      description: Retrieve the binary index for a code system from the server (if
        available)
      operationId: getBinaryIndexZip
      parameters:
      - description: "A code system identifier, e.g. http://snomed.info/sct"
        in: query
        name: codeSystemId
        required: true
        schema:
          type: string
      - description: The version of the specified code system
        in: query
        name: codeSystemVersion
        required: true
        schema:
          type: string
      - description: The internal version of the binary index format
        in: query
        name: indexVersion
        required: true
        schema:
          type: string
      responses:
        "200":
          content:
            application/zip:
              schema:
                type: string
                format: binary
          description: OK
      tags:
      - Syndication
  /synd/getSyndicationStatus:
    get:
      description: Get the downstream syndication status for a Resource on the server
      operationId: getSyndicationStatus
      parameters:
      - description: "The type of the resource, e.g. ValueSet, CodeSystem, NamingSystem"
        in: query
        name: resourceType
        required: true
        schema:
          type: string
      - description: The id of the resource
        in: query
        name: id
        required: true
        schema:
          type: string
      responses:
        "200":
          content:
            '*/*':
              schema:
                type: string
          description: OK
      tags:
      - Syndication
  /synd/redoPreload:
    post:
      description: "Re-executes the data load performed at start in the preload feed\
        \ without having to restart the server.<p>A successful result will provide\
        \ a Location header referencing the preload job, and return the job's current\
        \ status.<p>Execution will be asynchronous or synchronous depending upon the\
        \ configuration of atom.preload.async, which is true by default."
      operationId: redoPreload
      responses:
        "200":
          content:
            application/json:
              example:
                id: preload-20221018T145537+1000
                name: Preload content from classpath:preload.xml
                status: running
              schema:
                $ref: "#/components/schemas/Status"
          description: Preload execution has been started
        "500":
          content:
            application/fhir+json: {}
          description: Preload could not be re-executed
      tags:
      - Syndication
  /synd/setIndexSyndicationStatus:
    post:
      description: Change the downstream syndication status for a SNOMED/LOINC code
        system on the server
      operationId: setIndexSyndicationStatus
      parameters:
      - description: "A code system identifier, e.g. http://snomed.info/sct"
        in: query
        name: codeSystemId
        required: true
        schema:
          type: string
      - description: The version of the specified code system
        in: query
        name: codeSystemVersion
        required: true
        schema:
          type: string
      - description: Whether to publish a binary index for the code system
        in: query
        name: syndicate
        required: true
        schema:
          type: boolean
      responses:
        "200":
          description: OK
      tags:
      - Syndication
  /synd/setSyndicationStatus:
    post:
      description: Change the downstream syndication status for a Resource on the
        server
      operationId: setSyndicationStatus
      parameters:
      - description: "The type of the resource, e.g. ValueSet, CodeSystem, NamingSystem"
        in: query
        name: resourceType
        required: true
        schema:
          type: string
      - description: The id of the resource
        in: query
        name: id
        required: true
        schema:
          type: string
      - description: Whether to publish the resource in the downstream syndication
          feed
        in: query
        name: syndicate
        required: true
        schema:
          type: boolean
      responses:
        "200":
          description: OK
      tags:
      - Syndication
  /synd/syndication.xml:
    get:
      description: Retrieve the server's downstream syndication feed (if available)
      operationId: getSyndicationFeed
      parameters:
      - description: Filter feed to match these content identifiers; uses FHIR canonical
          syntax
        in: query
        name: canonical
        required: false
        schema:
          type: array
          items:
            type: string
      - description: Filter feed to match these categories
        in: query
        name: category
        required: false
        schema:
          type: array
          items:
            type: string
      - description: Filter feed to match these FHIR versions
        in: query
        name: fhirVersion
        required: false
        schema:
          type: array
          items:
            type: string
      responses:
        "200":
          content:
            application/atom+xml:
              schema:
                type: string
          description: OK
      tags:
      - Syndication
components:
  schemas:
    AtomArtifact:
      type: object
      properties:
        baseEffectiveTime:
          type: string
        baseModule:
          type: string
        bundleType:
          type: string
          enum:
          - DOCUMENT
          - MESSAGE
          - TRANSACTION
          - TRANSACTIONRESPONSE
          - BATCH
          - BATCHRESPONSE
          - HISTORY
          - SEARCHSET
          - COLLECTION
          - SUBSCRIPTIONNOTIFICATION
          - "NULL"
        codeSystem:
          $ref: "#/components/schemas/CodeSystemReference"
        contentItemIdentifier:
          type: string
        contentItemVersion:
          type: string
        dependencies:
          type: array
          items: {}
        id:
          type: string
        indexVersion:
          type: string
        security:
          type: array
          items:
            type: string
        signatures:
          type: object
          additionalProperties:
            type: string
        type:
          type: string
          enum:
          - LOINC
          - RF2_SOURCE_DELTA
          - RF2_SOURCE_SNAPSHOT
          - RF2_SOURCE_FULL
          - RF2_SOURCE_ALL
          - BINARY
          - FHIR_BUNDLE
          - FHIR_CODESYSTEM
          - FHIR_CONCEPTMAP
          - FHIR_VALUESET
          - FHIR_STRUCTUREDEFINITION
          - FHIR_NAMINGSYSTEM
          - FHIR_PACKAGE
          - BINARY_RETRACT
          - LOINC_RETRACT
          - FHIR_CODESYSTEM_RETRACT
          - FHIR_CONCEPTMAP_RETRACT
          - FHIR_VALUESET_RETRACT
          - FHIR_STRUCTUREDEFINITION_RETRACT
        validated:
          type: boolean
    CodeSystemDetails:
      type: object
      properties:
        id:
          type: string
        indexStatus:
          type: string
          enum:
          - OK
          - MISSING
          - CORRUPT
          - VERSION_MISMATCH
          - NOT_INDEXED
          - VERSION_UPGRADABLE
        isSupplement:
          type: boolean
        lastUpdated:
          type: string
        metaVersion:
          type: string
        sha256:
          type: string
        title:
          type: string
        url:
          type: string
        version:
          type: string
    CodeSystemInfo:
      type: object
      properties:
        binaryAvailable:
          type: boolean
        codeSystem:
          $ref: "#/components/schemas/CodeSystemReference"
        inDatabase:
          type: boolean
        name:
          type: string
        sourceAvailable:
          type: boolean
        status:
          type: string
          enum:
          - OK
          - MISSING
          - CORRUPT
          - VERSION_MISMATCH
          - NOT_INDEXED
          - VERSION_UPGRADABLE
        syndicated:
          type: boolean
    CodeSystemReference:
      type: object
      properties:
        caseSensitive:
          type: boolean
        id:
          type: string
        metaVersion:
          type: string
        url:
          type: string
        version:
          type: string
    Status:
      type: object
      properties:
        failing:
          type: boolean
        finished:
          type: boolean
        id:
          type: string
        status:
          type: string
          writeOnly: true
        success:
          type: boolean
