PrizmDoc Viewer v13.7 - Updated
Redaction Creator
API Reference > PrizmDoc Server API > Redaction Creator

Introduction

The redaction creator is designed to get a redactions markup for text matching a Regular Expression. The redaction markup can be used with the markup burner API to "burn" the redactions into a document.

Available URLs

URL Description
POST /v2/redactionCreators Creates and starts a new redaction creator process.
GET /v2/redactionCreators/{processId} Gets the state of an existing redaction creator process.

Deprecated URLs

URL Description
POST /PCCIS/V1/RedactionCreator Creates and starts a new RedactionCreator.
GET /PCCIS/V1/RedactionCreator/{processId} Gets the state and result of an existing RedactionCreator.

POST /v2/redactionCreators

Creates and starts a new redaction creator process.

A redaction creator represents a process that runs on the server which searches a document for text fragments matching specified rules and then, based on any matches, creates a new JSON Markup document containing redaction markup. The redaction markup that is created by this process can be used with the markup burner API to "burn" the redactions into a document.

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/redactionCreators/{processId} URL below to get the state and results of an in-progress or completed redaction creator process.

There are two required inputs to create a RedactionCreator:

See the work file API topic for more information about a WorkFile.

A new markup document will be created that will contain the redaction markup. The new document will be made available by a new WorkFile ID.

Request

Request Headers

Name Description
Content-Type Must be application/json
Accusoft-Affinity-Token The affinityToken of the work file specified by input.documentFileId. 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 work file does not exist.
580 "InternalError" The server encountered an internal error when handling the request.

Example

Request

POST /v2/redactionCreators
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "NmFzioyWzFM5ADpthsuitw"
    },
    "rules": [{
        "find": {
          "type": "regex",
          "pattern": "wat"
        },
        "redactWith": {
          "type": "RectangleRedaction"
        }
      },
      {
        "find": {
          "type": "regex",
          "pattern": "[0-9]{3}[-]?[0-9]{2}[-]?[0-9]{4}"
        },
        "redactWith": {
          "type": "RectangleRedaction",
          "borderColor": "#FF0000",
          "fillColor": "#FF0000",
          "fontColor": "#000000",
          "reason": "Redacted",
          "data": {
            "author": "John Smith",
            "phone": "+1 123 456 789"
          }
        }
      }
    ]
  }
}

Response

HTTP 200 OK
Content-Type: application/json
{
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "expirationDateTime": "2019-02-07T13:24:35.395Z",
  "input": {
    "source": {
      "fileId": "NmFzioyWzFM5ADpthsuitw"
    },
    "rules": [
    {
        "find": {
          "regex": "wat"
        },
        "redactWith": {
          "type": "RectangleRedaction"
        }
      },
      {
        "find": {
          "regex": "[0-9]{3}[-]?[0-9]{2}[-]?[0-9]{4}"
        },
        "redactWith": {
          "type": "RectangleRedaction",
          "borderColor": "#FF0000",
          "fillColor": "#FF0000",
          "fontColor": "#000000",
          "reason": "Redacted",
          "data": {
            "author": "John Smith",
            "phone": "+1 123 456 789"
          }
        }
      }
    ]
  },
  "state": "processing",
  "percentComplete": 0
}

GET /v2/redactionCreators/{processId}

Gets the state and result of an existing redaction creator process created by POST /v2/redactionCreators.

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

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

If the markup burning 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
Content-Type Must be application/json
Accusoft-Affinity-Token The affinityToken of the work file specified by input.documentFileId. Required when server clustering is enabled.

URL Parameters

Parameter Description
{processId} The id of the redaction creator process.

Response body

JSON object with the following properties:

Error Responses and JSON Error Codes

Status Code JSON errorCode Description
404 "ResourceNotFound" Redaction creator process specified by {processId} could be found.
200 "MarkupCreationError" The server encountered an error when creating the markup.
580 "InternalError" The server encountered an internal error when handling the request.

Example

Request

GET /v2/redactionCreators/iFhSZRvrz2vtFjcTSi9Qlg

Successful Response

When the redaction creator process completes with no errors:

HTTP 200 OK
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "NmFzioyWzFM5ADpthsuitw"
    },
    "rules": [
    {
        "find": {
          "regex": "wat"
        },
        "redactWith": {
          "type": "RectangleRedaction"
        }
      },
      {
        "find": {
          "regex": "[0-9]{3}[-]?[0-9]{2}[-]?[0-9]{4}"
        },
        "redactWith": {
          "type": "RectangleRedaction",
          "borderColor": "#FF0000",
          "fillColor": "#FF0000",
          "fontColor": "#000000",
          "reason": "Redacted",
          "data": {
            "author": "John Smith",
            "phone": "+1 123 456 789"
          }
        }
      }
    ]
  },
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "expirationDateTime": "2019-02-07T13:24:35.395Z",
  "state": "complete",
  "percentComplete": 100,
  "output": {
    "markupFileId": "eOsJIqI8aHkxVV0yJug"
  }
}

Error responses

When a redaction converter process does not exist for the given processId:

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

When source document is corrupted and Markup can not be created:

HTTP 200 OK
Content-Type: application/json
{
  "input": {
    "source": {
      "fileId": "NmFzioyWzFM5ADpthsuitw"
    },
    "rules": [
    {
        "find": {
          "regex": "wat"
        },
        "redactWith": {
          "type": "RectangleRedaction"
        }
      },
      {
        "find": {
          "regex": "[0-9]{3}[-]?[0-9]{2}[-]?[0-9]{4}"
        },
        "redactWith": {
          "type": "RectangleRedaction",
          "borderColor": "#FF0000",
          "fillColor": "#FF0000",
          "fontColor": "#000000",
          "reason": "Redacted",
          "data": {
            "author": "John Smith",
            "phone": "+1 123 456 789"
          }
        }
      }
    ]
  },
  "processId": "iFhSZRvrz2vtFjcTSi9Qlg",
  "state": "error",
  "errorCode": "MarkupCreationError",
  "percentComplete": 0,
  "expirationDateTime": "2019-02-07T13:24:35.395Z"
}

POST /PCCIS/V1/RedactionCreator

NOTE: This URL has been deprecated and will be removed from the public API in a future release. Please use the newer POST /v2/redactionCreators instead.

Creates and starts a new RedactionCreator.

A RedactionCreator represents a process that runs on the server which searches a document for text matching a Regular Expression and then, based on any matches, creates a new Markup XML document containing redaction markup. The redaction Markup XML that is created by this process can be used with the markup burner API to "burn" the redactions into a document.

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 /PCCIS/V1/RedactionCreator/{processId}] URL below to get the state and results of an in-progress or completed RedactionCreator process.

There are two required inputs to create a RedactionCreator:

See the work file API topic for more information about a WorkFile.

A new Markup XML document will be created that will contain the redaction markup. The new document will be made available by a new WorkFile ID.

By default, RedactionCreator objects will be automatically deleted 20 minutes after they are created.

Request

Request Headers

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

Request Body

In the request body, provide JSON containing the following properties:

Response Body

If successful, this method returns JSON containing the following properties:

Error Responses

Status Code Description
400 Bad Request, if input.documentFileId, input.autoRedactionRegularExpressions is missing or invalid format, or if minSecondsAvailable is not a number.
405 Method Not Allowed, if POST HTTP method is not used.

Examples

Request

POST prizmdoc_server_base_url/PCCIS/V1/RedactionCreator
Content-Type: application/json
Accusoft-Affinity-Token: ejN9/kXEYOuken4Pb9ic9hqJK45XIad9LQNgCgQ+BkM=

{
    "input": {
        "documentFileId": "ek5Zb123oYHSUEVx1bUrVQ",
        "autoRedactionRegularExpressions": [
            "[0-9]{3}[-]?[0-9]{2}[-]?[0-9]{4}"
        ]
    },
    "minSecondsAvailable": 60
}

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "input": {
        "documentFileId": "ek5Zb123oYHSUEVx1bUrVQ",
        "autoRedactionRegularExpressions": [
            "[0-9]{3}[-]?[0-9]{2}[-]?[0-9]{4}"
        ]
    },
    "expirationDateTime": "2014-12-17T20:38:39.796Z",
    "processId": "ElkNzWtrUJp4rXI5YnLUgw",
    "affinityToken": "ejN9/kXEYOuken4Pb9ic9hqJK45XIad9LQNgCgQ+BkM=",
    "state": "processing",
    "percentComplete": 0,
    "errorCode": null,
    "output": null
}

GET /PCCIS/V1/RedactionCreator/{processId}

NOTE: This URL has been deprecated and will be removed from the public API in a future release. Please use the newer POST /v2/redactionCreators and GET /v2/redactionCreators/{processId} instead.

Gets the state and result of an existing RedactionCreator.

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

When state is "complete", the new markup XML document containing redactions will be made available by a new WorkFile ID in the output.markupFileId. See the work file API topic to find out how to download a WorkFile.

If the markup burning process encountered an error, the state property will be "error", the errorCode property will contain an error code string and output will be null.

Request

Request Headers

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

URL Parameters

Parameter Description
{processId} The id of the process.

Response Body

If successful, this method returns JSON containing the following properties:

Error Responses

Status Code Description
404 Not Found, if {processId} does not exist.
405 Method Not Allowed, if GET HTTP method is not used.

Examples

Request

GET prizmdoc_server_base_url/PCCIS/V1/RedactionCreator/ElkNzWtrUJp4rXI5YnLUgw
Accusoft-Affinity-Token: ejN9/kXEYOuken4Pb9ic9hqJK45XIad9LQNgCgQ+BkM=

Response when the state is "processing"

HTTP/1.1 200 OK
Content-Type: application/json

{
    "input": {
        "documentFileId": "ek5Zb123oYHSUEVx1bUrVQ",
        "autoRedactionRegularExpressions": [
            "[0-9]{3}[-]?[0-9]{2}[-]?[0-9]{4}"
        ]
    },
    "expirationDateTime": "2014-12-17T20:38:39.796Z",
    "processId": "ElkNzWtrUJp4rXI5YnLUgw",
    "affinityToken": "ejN9/kXEYOuken4Pb9ic9hqJK45XIad9LQNgCgQ+BkM=",
    "state": "processing",
    "percentComplete": 0,
    "errorCode": null,
    "output": null
}

Response when the state is "complete"

HTTP/1.1 200 OK
Content-Type: application/json

{
    "input": {
        "documentFileId": "ek5Zb123oYHSUEVx1bUrVQ",
        "autoRedactionRegularExpressions": [
            "[0-9]{3}[-]?[0-9]{2}[-]?[0-9]{4}"
        ]
    },
    "expirationDateTime": "2014-12-17T20:38:39.796Z",
    "processId": "ElkNzWtrUJp4rXI5YnLUgw",
    "affinityToken": "ejN9/kXEYOuken4Pb9ic9hqJK45XIad9LQNgCgQ+BkM=",
    "state": "complete",
    "percentComplete": 100,
    "errorCode": null,
    "output": {
        "markupFileId": "vry3FPE0zQqYwhzndRccOQ"
    }
}

Response when the state is "error" because the work file that represents the source document whose text will be searched could not be found

HTTP/1.1 200 OK
Content-Type: application/json

{
    "input": {
        "documentFileId": "ek5Zb123oYHSUEVx1bUrVQ",
        "markupFileId": "aQ1BdViqmUisBuevJKO9Sw"
    },
    "expirationDateTime": "2014-12-17T20:38:39.796Z",
    "processId": "ElkNzWtrUJp4rXI5YnLUgw",
    "affinityToken": "ejN9/kXEYOuken4Pb9ic9hqJK45XIad9LQNgCgQ+BkM=",
    "state": "error",
    "percentComplete": 0,
    "errorCode": "DocumentFileIdDoesNotExist"
}