PrizmDoc® v14.2 Release - Updated
PrizmDoc / API Reference / PrizmDoc Server REST API / Viewer Support / Document Queriers
In This Topic
    Document Queriers
    In This Topic

    Introduction

    The search context and Document Queriers REST APIs (which is part of the "Document Q&A" feature) allow your application to query a document.

    A document querier resource represents an asynchronous document querying process and yields a query response when available.

    IMPORTANT: This API will continue to evolve as we refine these features and extend our cloud service offerings.

    Available URLs

    URL Description
    POST /v2/documentQueriers Creates a new document querier for a search context, starting the process of querying.
    GET /v2/documentQueriers/{processId} Gets information about a document querier.

    POST /v2/documentQueriers

    Creates a new document querier for a search context, starting the process of document querying.

    After a successful POST to create the document querier, we immediately begin a background process to start a document query for you to GET. Once the full text of the document has been searched and a response exists for the query, the document querier state will change from "processing" to "complete".

    Request

    Request Headers

    Name Description
    Content-Type Must be application/json
    Accusoft-Affinity-Token The affinityToken of the search context specified by input.contextId. Required when server clustering is enabled.

    Request Body

    • input
      • contextId (String) Required. Identifies the search context which holds the full-text data to query.
      • query (String) Required. A question for querying the document.
    • minSecondsAvailable (Integer) The minimum number of seconds this document querier will remain available. The actual lifetime may be longer. The default lifetime is defined by the processIds.lifetime central configuration parameter.

    Successful Response

    Response Body

    JSON with metadata about the created document querier.

    • input (Object) Input we accepted to create the document querier.
    • processId (String) Unique id for this document querier.
    • affinityToken (String) Affinity token for this document querier. Present when clustering is enabled.
    • state (String) State of document querying.
      • "processing" - The querying is still being executed.
      • "complete" - The querying is complete.
      • "error" - There was a problem performing the querying.
    • percentComplete (Integer) Percentage of document querying which has completed (from 0 to 100).
    • expirationDateTime (String) Currently planned date and time when the document querier resource will expire and no longer be available for use. Format is RFC 3339 Internet Date/Time profile of ISO 8601, e.g. "2024-11-05T08:15:30.494Z".

    Error Responses

    Status Code JSON errorCode Description
    400 "MissingInput" Can occur when clustering is enabled and an Accusoft-Affinity-Token request header was not provided.
    480 "MissingInput" A required input value was not provided. See errorDetails in the response body.
    480 "InvalidInput" An invalid input value was used. See errorDetails in the response body.
    480 "ResourceNotFound" Can occur when the search context specified by contextId could not be found. See errorDetails in the response body.
    480 "ResourceNotUsable" Can occur when the search context specified by contextId is not usable. See errorDetails in the response body.
    480 "FeatureNotLicensed" You are not licensed to use the document querying feature.
    580 "InternalError" The server encountered an internal error when handling the request.

    Example

    Request

    POST prizmdoc_server_base_url/v2/documentQueriers
    Content-Type: application/json
    Accusoft-Affinity-Token: ejN9/kXEYOuken4Pb9ic9hqJK45XIad9LQNgCgQ+BkM=
    
    {
      "input": {
        "contextId": "ElkNzWtrUJp4rXI5YnLUgw",
        "query": "What does the acronym EMT refer to?"
      },
      "minSecondsAvailable": 600
    }
    
    

    NOTE: See the Base URL for PAS topic for more information.

    Response

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "input": {
        "contextId": "ElkNzWtrUJp4rXI5YnLUgw",
        "query": "What does the acronym EMT refer to?"
      },
      "processId": "pR5X6nPDgMwat6cxlmn0Q3",
      "state": "processing",
      "percentComplete": 0,
      "expirationDateTime": "2024-12-17T20:38:39.796Z"
    }
    
    

    GET /v2/documentQueriers/{processId}

    Gets a response from a document query.

    This URL is designed to give you the document query response when it becomes available.

    Request

    URL Parameters

    Parameter Description
    {processId} The processId which identifies the document querier.

    Successful Response

    Response Body

    JSON with the available document query response.

    • response (String) Always present. String containing the document query response. If no response is available, this string will be empty.

    Error Responses

    Status Code JSON errorCode Description
    404 - No document querier with the provided {processId} could be found.
    400 "MissingInput" Can occur when clustering is enabled and an Accusoft-Affinity-Token request header was not provided.
    480 "InvalidInput" An invalid input value was used. See errorDetails in the response body.
    480 "ResourceNotUsable" Can occur when the document querier is in a state of "error". You may be able to get more information from a GET /v2/documentQueriers/{processId}.
    580 "InternalError" The server encountered an internal error when handling the request.

    Example

    Here is an example request and response illustrating how you would acquire the query response from the document querier.

    You would GET like so:

    GET prizmdoc_server_base_url/v2/documentQueriers/pR5X6nPDgMwat6cxlmn0Q3
    
    

    NOTE: See the Base URL for PAS topic for more information.

    HTTP/1.1 200 OK
    Content-Type: application/json
    
    {
      "response": "EMT stands for Emergency Medical Technician. An Emergency Medical Technician is a trained medical professional."
    }