PrizmDoc Viewer v13.9 - Updated
Plain Text Redactors
API Reference > PrizmDoc Server API > Plain Text Redactors

Introduction

The Plain Text Redactors API allows you to take a source document and a redaction markup file as input and produce redacted plain text as output.

Available URLs

URL Description
POST /v2/plainTextRedactors Creates and starts a new plain text redactor process.
GET /v2/plainTextRedactors/{processId} Gets the state of an existing plain text redactor process.

POST /v2/plainTextRedactors

Creates and starts a new plain text redactor process.

A plain text redactor represents a process that runs on the server and creates a plain text file with the text from the source document. Each redacted text fragment is replaced with the string "<Text Redacted>".

The server process to create the redaction markup is started by this request, but a response is sent before the process is complete. Use the GET /v2/plainTextRedactors/{processId} URL below to get the state and results of an in-progress or completed plain text redactor process.

A new plain text document will be created that will contain the redacted document text. The new document will be made available by a new WorkFile ID.

NOTES:

  1. Plain text redactor supports the following mark types (see Markup JSON Specification):

    • TextSelectionRedaction
    • RectangleRedaction

      Other types of marks will have no effect on the result.

  2. Plain text redactor will produce an empty plain text document for raster documents.

  3. CAD files are not supported.

Request

Request Headers

Name Description
Content-Type Must be application/json
Accusoft-Affinity-Token The affinityToken of work files specified by input.source.fileId and input.markup.fileId. Required when server clustering is enabled.

Request Body

JSON object conforming to the following:

Successful Response

Response body

JSON object with the following properties:

Error Responses

Status Code JSON errorCode Description
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 "UnrecognizedInput" An unrecognized JSON property was provided. See errorDetails in the response body.
480 "ResourceNotFound" Source document or markup work file does not exist. See errorDetails in the response body.
580 "InternalError" The server encountered an internal error when handling the request.

Example

Request

POST /v2/plainTextRedactors
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    },
    "markup": {
      "fileId": "vry3FPE0zQqYwhzndRccOQ"
    },
    "dest": {
      "lineEndings": "\n"
    }
  },
  "minSecondsAvailable": 60
}

Response

HTTP 200 OK
Content-Type: application/json
{
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "expirationDateTime": "2019-02-07T13:24:35.395Z",
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    },
    "markup": {
      "fileId": "vry3FPE0zQqYwhzndRccOQ"
    },
    "dest": {
      "lineEndings": "\n"
    }
  },
  "state": "processing",
  "percentComplete": 0
}

GET /v2/plainTextRedactors/{processId}

Gets the state and result of an existing plain text redactor process created by POST /v2/plainTextRedactors.

Requests can be sent to this URL repeatedly while state is "processing".

When state is "complete", the new plain text document containing the redacted document text will be made available by a new WorkFile ID in the output.fileId. See the work file API topic to find out how to download a WorkFile.

If the plain text redactor process encountered an error, the state property will be "error" and the errorCode property will contain an error code string.

Request

Request Headers

Name Description
Accusoft-Affinity-Token The affinityToken of the plain text redactor process. Required when server clustering is enabled.
Parameter Description
{processId} The id of the plain text redactor process.

Response body

JSON object with the following properties:

Error Responses and JSON Error Codes

Status Code JSON errorCode Description
404 "ResourceNotFound" Text redactor process specified by {processId} could be found.
200 "InvalidJson" Provided markup work file cannot be parsed as JSON.
200 "InvalidMarkup" Provided markup JSON does not satisfy the Markup JSON Specification.
200 "MarkRefersToNonExistentPage" Provided markup JSON refers to a non-existent page in the source document. See errorDetails in the response body.
200 "UnsupportedSourceDocument" Provided source document is a CAD file and it is not supported.
580 "InternalError" The server encountered an internal error when handling the request.

Example

Request

GET /v2/plainTextRedactors/iFhSZRvrz2vtFjcTSi9Qlg

Successful Response

When the plain text redactor process completes with no errors:

HTTP 200 OK
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    },
    "markup": {
      "fileId": "vry3FPE0zQqYwhzndRccOQ"
    },
    "dest": {
      "lineEndings": "\n"
    }
  },
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "expirationDateTime": "2019-02-07T13:24:35.395Z",
  "state": "complete",
  "percentComplete": 100,
  "output": {
    "fileId": "eOsJIqI8aHkxVV0yJug"
  }
}

Error responses

Response when a plain text redactor process does not exist for the given processId:

HTTP 404
Content-Type: application/json
{
  errorCode: 'ResourceNotFound'
}

Response when provided markup work file cannot be parsed as JSON:

HTTP 200 OK
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    },
    "markup": {
      "fileId": "vry3FPE0zQqYwhzndRccOQ"
    },
    "dest": {
      "lineEndings": "\n"
    }
  },
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "state": "error",
  "errorCode": "InvalidJson",
  "percentComplete": 0,
  "expirationDateTime": "2019-02-07T13:24:35.395Z"
}

Response when markup JSON does not satisfy the Markup JSON Specification:

HTTP 200 OK
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    },
    "markup": {
      "fileId": "vry3FPE0zQqYwhzndRccOQ"
    },
    "dest": {
      "lineEndings": "\n"
    }
  },
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "state": "error",
  "errorCode": "InvalidMarkup",
  "percentComplete": 0,
  "expirationDateTime": "2019-02-07T13:24:35.395Z"
}

Response when markup refers to a page that does not exist in the source document:

{
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    },
    "markup": {
      "fileId": "vry3FPE0zQqYwhzndRccOQ"
    },
    "dest": {
      "lineEndings": "\n"
    }
  },
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "state": "error",
  "errorCode": "MarkRefersToNonExistentPage",
  "expirationDateTime": "2019-02-07T13:24:35.395Z"
}

Response when source document is a CAD file:

{
  "input": {
    "source": {
      "fileId": "ek5Zb123oYHSUEVx1bUrVQ"
    },
    "markup": {
      "fileId": "vry3FPE0zQqYwhzndRccOQ"
    },
    "dest": {
      "lineEndings": "\n"
    }
  },
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "state": "error",
  "errorCode": "UnsupportedSourceDocument",
  "expirationDateTime": "2019-02-07T13:24:35.395Z"
}