Viewing Session
POST /ViewingSession
Routes key: PostViewingSession
Body: a JSON object
PrizmApplicationServices will handle properties in the source parameter and any other properties will be forwarded to PCCIS when creating the viewing session.
Property | Type | Description |
---|---|---|
source | {object} | Properties relevant to PrizmApplicationServices will reside in this object. Note: This object will be removed before sending the rest of the body to PCCIS. |
source.type | {string} | Specify where PrizmApplicationServices can find the document. Can be "document", "url", or "upload". |
source.fileName | {string} | (Required if source.type="document"). Filename that the Storage Provider API can use. |
source.url | {string} | (Required if source.type="url"). URL to create a viewing session from. |
source.headers | {object} (optional) | (Optionally used if source.type="url"). Request headers to send from PrizmApplicationServices when retrieving the URL. |
source.acceptBadSslCertificate | {boolean=false} (optional) | (Optionally used if source.type="url"). If true, requires SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that CA as an option. |
source.displayName | {string} | (Required if source.type="upload"). The display name of the document that’s being uploaded. E.g. "Sample-2015-09-30T19:17:24Z.doc" |
source.markupId | {string} | The ID to use when querying markup with the XML and JSON layer APIs. If one isn’t passed, we create one from the other information we’re given. |
source.downloadName | {string} (optional) | The name that will be used when downloading the original document. We will use the "displayName" or "fileName" if this option is not provided. |
source.fileExtension | {string} (optional) | A file extension that’s used if the File Detection Service cannot determine what type of file was uploaded. We will get the extension from "displayName" or "fileName" if this option is not provided. |
Examples
Create a session using a local document
Use Storage Provider to find the correct document and uses it to create a viewing session.
POST http://localhost:3000/ViewingSession
Content-Type: application/json
{
"source": {
"type": "document",
"fileName": "sample.doc"
}
}
Successful Response:
200 OK
Content-Type: application/json
{ "viewingSessionId": "{viewingSessionId}" }
Errored Response:
404 Not Found
Content-Type: application/json
{ "errorCode": "DocumentNotFound" }
Create a session using a url
POST http://localhost:3000/ViewingSession
Content-Type: application/json
{
"source": {
"type": "url",
"url": "http://google.com/",
"headers": {
"user-agent": "PrizmShare"
},
"acceptBadSslCertificate": true
}
}
Successful Response:
200 OK
Content-Type: application/json
{ "viewingSessionId": "{viewingSessionId}" }
Passing Additional parametes to the back end
POST http://localhost:3000/ViewingSession
Content-Type: application/json
{
"source": {
"type": "document",
"fileName": "sample.doc"
},
"watermarks": [
{
"type": "text",
"opacity": 0.6,
"text": "jdoe\n67.79.169.114\n11/13/2014 2:24 PM\nNOT FOR DISTRIBUTION",
"color": "red",
"fontFamily": "Consolas",
"fontSize": "16pt",
"fontWeight": "bold",
"verticalAlign": "bottom",
"horizontalAlign": "right"
}
]
}
Successful Response:
200 OK
Content-Type: application/json
{ "viewingSessionId": "{viewingSessionId}" }
Create a session by uploading a document
Creates a new blank session
POST htp://localhost:3000/ViewingSession
Content-Type: application/json
{
"source": {
"type": "upload",
"displayName": "sample_2015-10-31T19:15:32Z.doc"
}
}
While the above is the minimum required data, when uploading a file, it is also a good idea to add the markupId
property in source
, as such:
{
"source": {
"type": "upload",
"displayName": "sample_2015-10-31T19:15:32Z.doc",
"markupId": "YSB1bmlxdWUgdmFsdWU="
}
}
When this value is provided, PAS will use it when saving and reading markup files for this document. This ID needs to be unique for the binary document being used. Note that if your system contains mutable documents -- one that the user can edit and the system will still see it as a separate document -- this ID needs to take into account the revision of the document, as an edited version of the same document is considered a new, unique, document by Prizm Content Connect. If this ID is not provided, PAS will hash the displayName
value, which would in turn have the same uniqueness requirements.
Successful Response:
200 OK
Content-Type: application/json
{ "viewingSessionId": "{viewingSessionId}" }
PUT /ViewingSession/u{viewingSessionId}/SourceFile
Routes key: PutViewingSessionSourceFile
Uploads a document to the session.
Headers:
- Accusoft-Secret: mysecretkey
Body: a document
Exampes
PUT http://localhost:3000/ViewingSession/u{viewingSessionId}/SourceFile
Accusoft-Secret: mysecretkey
Body: a document
Successful Response:
200 OK
Errored Response:
403 Forbidden
Content-Type: application/json
{ "errorCode": "InvalidSecret" }