PrizmDoc
Viewing Package Validators

Pre-Conversion Services developer preview

Pre-Conversion Services are included as a "Developer Preview." This feature is in late-stage development and api's marked as such should be used for evaluation purposes only and should not be used in production deployments. Note that these api's may undergo change prior to feature completion. The Pre-Conversion Services will be feature complete in PrizmDoc version 11.1. The Viewing Package Creator API provides a facility to fully convert a document for viewing prior to the creation of a Viewing Session. If a large document is converted for viewing at the time a Viewing Session is created, the user may experience a delay when viewing later pages in the document. By converting a document prior to viewing, the entire document is available for viewing immediately.

Viewing Package Validators

POST /v2/viewingPackageValidators

This request starts a new process which validates the entire cache of a previously generated viewing package to ensure that all data is present. Each request will create a new independent validation process, even when the input.documentId values are the same. The response will contain a JSON object in the body with the input object provided during the POST. Note: This input object will not include any unsupported properties that may have been provided in the POST request.

Headers:

Body:

A JSON object

The table below shows the properties available for the POST request:

Property Type Required Description
input {object} Yes Properties relevant to PAS will reside in this object. NOTE: This object will be removed before sending the rest of the body to the backend services.
input.documentId {string} Yes A customer supplied identifier which is used to uniquely identify the resulting viewing package. The documentId is required to have a non-zero length less than 256 characters and must consist of characters defined by RFC4648 - Base 64 Encoding with URL and Filename Safe Alphabet.
minSecondsAvailable {integer} Optional (if a value is not provided, the default value = 3600 seconds will be used) Defines the minimum number of seconds for the conversion process to remain available to GET status. By default this is 3600 seconds because by default, the Viewing Sessions timeout after 20m.
Response

Headers:

Body

Body containing JSON object with information about the started process. The table below gives an explanation of the properties available in the response body:

Name Type Description
input.documentId {string} The documentId of the viewing package whose cache will be validated.
minSecondsAvailable {number} Defines the minimum number of seconds for the conversion process to remain available to GET status.
expirationDateTime {string} ISO8601 date and time (in UTC) string when the process will expire and no longer be available.
processId {string} The ID of the process to validate the cache for a viewing package.
state {string} The current state of the process. Possible values are: "processing" Note: “complete” and “error” will only be possible from the GET request below.
percentComplete {number} The percentage (0 – 100) complete of the markup burning process. Note: The value will always be 0 in the response from the POST

Example

Start a new process to validate a previously created package

POST http://localhost:3000/v2/viewingPackageValidators
Content-Type: application/json
{
    "input": {
        "documentId": "unT67Fxekm8lk1p0kPnyg8",
     },
     "minSecondsAvailable": 3600
 }

Successful Response:

200 OK
Content-Type: application/json
{
    "input": {
        "documentId": "unT67Fxekm8lk1p0kPnyg8",
     },
     "expirationDateTime": "2015-12-09T06:22:18.624Z",
     "processId": "bnaerfKLj2g6gv8fdqg823",
     "state":"processing",
     "percentComplete": 0
}

Errored Responses:

Examples of Input Validation error responses

If a POST request is made with the body missing a required property documentId, an error similar to the one below will be returned.

480 MissingInput
Content-Type: application/json
{
    "errorCode": "MissingInput",
    "errorDetails": {
        "in": "body",
        "at": "documentid"
    }
}

480 InvalidInput
Content-Type: application/json
{
    "errorCode": "InvalidInput",
    "errorDetails": {
        "in": "body",
        "at": "input",
        "expected": {
            "minSecondsAvailable": number
        }
    }
}

If a POST request is made with the body containing a non-existent/invalid documentId, an error similar to the one below will be returned.

480 InvalidInput
'Content-Type': 'application/json'
{
    'errorCode': 'InvalidInput',
    'errorDetails': {
        'in': 'body',
        'at': 'input.documentId'
    }
}    

POST with an invalid or a missing secret header

If a POST request is made with either a missing or an invalid header Accusoft-Secret, an error similar to the one below will be returned.

403 InvalidSecret
Content-Type: application/json
{
    "errorCode": "InvalidSecret"
}

POST request is made when a conversion is still in progress, an error similar to the one below will be returned.

580 ConversionInProgress
Content-Type: application/json
{
    "errorCode": "ConversionInProgress"
}

GET /v2/viewingPackageValidators/{processId}

Provides information about a currently running validation process, or one that has previously run and completed. Requests to this URL can be sent repeatedly while the state="processing". To limit network congestion, an exponential back-off algorithm is recommended. This means that the time interval between each request is increased, which results in a good trade-off between quickly discovering short conversions that have completed and preventing a large number of requests for long conversions.

Upon successful package validation, the response will have the state="complete" with percentComplete=100.

Headers:

Body

None

Response

Headers:

Body

Body containing JSON object with information about the validation process. The table below gives an explanation of the properties available in the response body when the process is complete:

Name Type Description
input.documentId {string} The documentId of the viewing package whose cache will be validated.
output.cacheState {string} The current state of the cache. Possible values are:"valid" means that all artifacts in the cache are present, "invalid" means that some or all of the artifacts are missing.
expirationDateTime {string} ISO8601 date and time (in UTC) string when the process will expire and no longer be available.
processId {string} The ID of the process to validate the cache for a viewing package.
state {string} The current state of the process. Possible values are: 1. processing 2. complete 3. error
percentComplete {number} The percentage (0 – 100) complete of the markup burning process.

Example

GET /v2/viewingPackageValidators/bnaerfKLj2g6gv8fdqg823

Successful Response:

200 OK
Content-Type: application/json
{
    "input": {
            "documentId": "unT67Fxekm8lk1p0kPnyg8",
        },
     "output": {
        "cacheState": "valid | invalid"
    },
    "expirationDateTime": "2015-12-09T06:22:18.624Z",
    "processId": "bnaerfKLj2g6gv8fdqg823",
    "state": "complete",
    "percentComplete": 100
}

Errored Responses:

If a request is made with an invalid processId or has expired, an error will be returned.

404 Not Found

GET with an invalid or a missing secret header

If a GET request is made with either a missing or an invalid header Accusoft-Secret, an error similar to the one below will be returned.

403 InvalidSecret
Content-Type: application/json
{
    "errorCode": "InvalidSecret"
}

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback