PrizmDoc® Viewer v14.0 Release - Updated
PrizmDoc Viewer / Developer Guide / PAS / Store Annotations in a Database
In This Topic
    Store Annotations in a Database
    In This Topic

    Introduction

    PrizmDoc Application Services (PAS) stores annotations locally by default. This topic shows you how to configure PrizmDoc so that annotations are stored in a database instead.

    Rerouting any Request to PAS

    PAS allows you to configure certain requests to go to a certain endpoint that would otherwise be handled by PAS. You can do this by rerouting any request to PAS.

    For example, the PAS API endpoint GET /MarkupLayers/u{viewingSessionId} returns all available markup layers. You can override this and implement your own logic for returning markup layers using the Routes key: GetMarkupLayers.

    By adding routeHandlers.GetMarkupLayers.url: "YOUR ENDPOINT HERE" to the PAS configuration, you can handle any request to /MarkupLayers/u{viewingSessionId} with your own endpoint.

    NOTE: On Windows, assuming a default installation, the configuration file is located at: C:\Prizm\pas\pcc.win.yml. For Docker, the configuration file pcc.nix.yml is located in the folder that you mapped as /config when creating the container. See Installing / Using Docker for more details.

    Handling the Saving & Loading of Annotations

    If you want to handle all saving and loading of annotations, for example to save them to your own database, you'll add the following to the PAS configuration:

    routeHandlers.GetMarkupLayers.url: "YOUR ENDPOINT HERE"

    routeHandlers.GetMarkupLayer.url: "YOUR ENDPOINT HERE"

    routeHandlers.CreateMarkupLayer.url: "YOUR ENDPOINT HERE"

    routeHandlers.UpdateMarkupLayer.url: "YOUR ENDPOINT HERE"

    routeHandlers.DeleteMarkupLayer.url: "YOUR ENDPOINT HERE"

    Then in your application, you will need to handle the following endpoints:

    GET /MarkupLayers/u{viewingSessionId}

    GET /MarkupLayers/u{viewingSessionId}/{layerRecordId}

    POST /MarkupLayers/u{viewingSessionId}

    PUT /MarkupLayers/u{viewingSessionId}/{layerRecordId}

    DELETE /MarkupLayers/u{viewingSessionId}/{layerRecordId}

    It will be up to you to decide how to implement these APIs as long as they return what is required based on the API documentation.

    For example, a successful POST request with new layer data should return a layerRecordId. It is up to you to generate this ID and store the associated layer data in a database. Then when getting this data back with a request to GET /MarkupLayers/u{viewingSessionId}/{layerRecordId}, you will use that layerRecordId to query the database and retrieve your data.