openapi: 3.0.1
info:
  title: management-api
  description: REST API documentation for the management-api
  license:
    name: "The Apache License, Version 2.0"
    url: http://www.apache.org/licenses/LICENSE-2.0.txt
  version: 0.6.0
servers:
- url: /
paths:
  /bpn-directory:
    get:
      tags:
      - BDRS Server Management API
      description: Gets a binary gzipped stream with BPN/DID mapping entries.
      operationId: getData
      responses:
        "200":
          description: The GZipped binary stream contains BPN-to-DID mapping entries.
        "400":
          description: Request body was malformed
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "401":
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "403":
          description: User is not authorized to obtain BPN/DID mapping data
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
    put:
      tags:
      - BDRS Server Management API
      description: Updates a BpnMapping entry
      operationId: update
      requestBody:
        content:
          '*/*':
            schema:
              $ref: "#/components/schemas/BpnMapping"
      responses:
        "204":
          description: BPN/DID mapping entry successfully created
        "400":
          description: Request body was malformed
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "401":
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "403":
          description: User is not authorized to update BPN/DID mapping data
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "404":
          description: No mapping for that BPN was registered
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
    post:
      tags:
      - BDRS Server Management API
      description: "Creates a new BpnMapping entry, or updates an existing one."
      operationId: save
      requestBody:
        content:
          '*/*':
            schema:
              $ref: "#/components/schemas/BpnMapping"
      responses:
        "204":
          description: BPN/DID mapping entry successfully created (updated).
        "400":
          description: Request body was malformed
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "401":
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "403":
          description: User is not authorized to create BPN/DID mapping data
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
  /bpn-directory/{bpn}:
    delete:
      tags:
      - BDRS Server Management API
      description: Removes a BpnMapping entry for the given BPN
      operationId: delete
      parameters:
      - name: bpn
        in: path
        required: true
        style: simple
        explode: false
        schema:
          type: string
      responses:
        "204":
          description: BpnMapping entry was deleted successfully
        "400":
          description: Request body was malformed
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "401":
          description: User is not authenticated
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "403":
          description: User is not authorized to delete BPN/DID mapping data
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
        "404":
          description: No mapping for that BPN was registered
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiErrorDetail"
components:
  schemas:
    ApiErrorDetail:
      type: object
      properties:
        invalidValue:
          type: object
        message:
          type: string
        path:
          type: string
        type:
          type: string
      example:
        path: path
        message: message
        type: type
        invalidValue: "{}"
    BpnMapping:
      type: object
      properties:
        bpn:
          type: string
        did:
          type: string
      example:
        bpn: bpn
        did: did
