Developer Guide (API Reference) > RESTful Web APIs > Web Tier RESTful Web API |
This API Reference section provides information about the RESTful Web public API.
The Web Tier application interface (API) uses a RESTful scheme where a specific method is tied to the Uniform Resource Locator (URL). The Http verbs are important in that they convey whether information is being read (GET) by the client or written (POST) from the client. The pccViewer control employs this communication scheme to display documents and annotations.
The following RESTful API describes the client (Web browser) to Web Tier (Server side) communications. Parameters enclosed in curly brackets “{}” are parameters that are replaced by their correct content. Parameters in square brackets “[]” denote a choice where one of the value choices needs to be present. The URLs illustrated below are partial URLs; the complete URL will begin with an HTTP or HTTPS and the company domain along with a port number (if the default port number is not used and virtual directory).
URL: …/ PCC.ashx /Page/q/{pageNumber}/Attributes?DocumentID=[e,u]{DocumentFIleName}
This API requests or reads the information about a particular document page. The return information is a JSON string. The form has a query parameter, DocumentID, which can have for its value an unencoded “u” prefix followed by the document identification or a base 64 encoded name prefixed with “e”. The {PageNumber} parameter always begins with zero (0) for the first page within a document.
Example |
Copy Code
|
---|---|
Http Verb = GET …PCC.ashx/Page/q/0/Attributes?DocumentID=eUwBhAG0AcABsAGUALgBkAG8AYwA1 |
JSON string is returned with the following information:
JSON Response Example |
Copy Code
|
---|---|
{"contentType":"jpeg,png,svg","imageBitDepth":8,"imageHeight":1650,"imageWidth":1275,"imageXResolution":0,"imageYResolution":0} |
Http Verb = GET URL:.../PCC.ashx/Page/q/{pageNumber}?DocumentID=[e,u]{DocumentFIleName}&Scale={Scale value}&ContentType=[jpeg, png, svg]
This RESTful API returns a full page image. The scale and ContentType query parameters affect the image with respect to the parameters intent. The ContentType parameter may have the following parameter value for now: JPEG,PNG or SVG. If SVG is chosen, the scale values is ignored as a SVG (vectored) stream is returned for which this parameter have no practical meaning. The scale query parameter with a value 1.0 gives a non-resized image. Less than 1.0 values shrink the image and larger than 1.0 values increase the image size.
Http Verb = GET URL:../PCC.ashx/Page/q/{pageNumber}/Tile/{x}/{y}/{width}/{height}}?DocumentID=[e,u]{DocumentFIleName}&Scale={Scale Value}&ContentType=png
This request returns a tile of the requested document page. The tile is formed from the pixel coordinate specified by the x and y parameters and the width and height parameters. This tile is resized as determined by the scale factor. The contentType should only be PNG for tiles as JPEG can cause artifact issues in alignment. Requesting SVG content will cause an error response as this content type is vector data and does need to be tiles like raster images. The scale query parameter with a value 1.0 gives a non-resized image. Less than 1.0 values shrink the tile and larger than 1.0 values increase the tile size.
Example |
Copy Code
|
---|---|
URL:../PCC.ashx/Page/q/0/Tile/0/0/1275/1024?DocumentID=eUwBhAG0AcABsAGUALgBkAG8AYwA1&Scale=0.5&ContentType=png |
Verb=GET URL:../PCC.ashx/Document/q/Attributes?DocumentID=[e,u]{DocumentFIleName}&DesiredPageCountConfidence={percentage Value}
This request returns a JSON string giving the page count of the document requested and the confidence value. Because page rendering may be different than what a file format may indicate for number of pages, there is a need for a confidence value indicating how confident the page count acquired will be prior to having all the pages generated. The DesiredPageCountConfidence parameter indicates what the minimum level required to be returned thus implying how long the request may take to return a precise value. The DesiredPageCountConfidence is segmented in this release where 50 percent or below may get an estimate page count value and above 50 percent will try to get a more accurate count. If a pageCountConfidence value of less than 100 percent is returned, it means that the request is still being worked on and to try again if an accurate count is still desired.
Example |
Copy Code
|
---|---|
URL:..PCC.ashx/Document/q/Attributes?DocumentID=eUwBhAG0AcABsAGUALgBkAG8AYwA1&DesiredPageCountConfidence=50 |
Example Response |
Copy Code
|
---|---|
{"pageCount":3,"pageCountConfidence":100} |
Document Information or metrics.
Verb=GET URL:../PCC.ashx/Document/q/Attributes/{Metrics}?DocumentID=[e,u]{DocumentFIleName}&DesiredPageCountConfidence={percentage Value}
The Metrics string is composed of specific parameters indicating what document information is needed. The parameters are separated by an underscore character (_). For PCC7, two metric parameters are PageCount and DocumentContentType. They can be sent paired together separated by an underscore or sent individually. For PageCount, a query string must be added to indicate the desired confidence level returned.
In all cases, a JSON string shall be the response. The JSON contents will include elements requested with appropriate content values. The PageCount request will return pageCount and pageCountConfidence values. The DocumentContentType will return documentContentType and documentFormat information where documentContentType denotes acceptable conversion requests and documentFormat indicates the actual document format.
The conversion output formats will be confined to values of PNG,JPEG and SVG (for HTML SWF is ignored). The JSON string in all cases will indicate the major version of the product which generated the string and for PPC7 it would be 7.
Document JSON string with both parameters indicated:
{“version”:<Product numeric version>,” pageCountConfidence ”:<1-100>,”pageCount”:<estimated or actual page count>,” documentFormat”:<File format type>,” documentContentType ”:<string indicating requested typed permitted for given format>}.
Example |
Copy Code
|
---|---|
URL:..PCC.ashx/Document/q/Attributes/PageCount_DocumentContentType?DocumentID=eUwBhAG0AcABsAGUALgBkAG8AYwA1&DesiredPageCountConfidence=50 |
Example Response |
Copy Code
|
---|---|
{"version":"7.0","pageCountConfidence":100,"pageCount":3,"documentFormat":"doc","documentContentType":"jpg,png,swf,svg"} |
Http Verb = [GET,POST] URL:../PCC.ashx/Document/q/Art/q?DocumentID=[e,u]{DocumentFIleName}&AnnotationID=[e,u]{{AnnotationIdentification}
This URL location can be read (GET) or written (POST) with XML formatted annotations. The ART annotation format is documented in the Document Annotations section.
Example |
Copy Code
|
---|---|
URL:../PCC.ashx/Document/q/Art/q?DocumentID=eUwBhAG0AcABsAGUALgBkAG8AYwA1&AnnotationID=eUwBhAG0AcABsAGUA0 |
Text extraction.
Verb=GET URL:../PCC.ashx/Document/q/{pageNumberBegin}-{pageNumberEnd}/Text?DocumentID=[e,u]{DocumentFileName}
This request returns a JSON string containing the text extracted from the given document. The {pageNumberBegin} denotes the first page and {pageNumberEnd} denotes the last page to be included the extracted text. The lowest value for {pageNumberBegin} parameter is zero (0) – that indicates the first page within the document.
JSON string is returned with the following information:
pages | Structure containing the extracted pages with the extracted text. |
number | Denotes the page number for the extracted text, counts from zero (0). |
text | Extracted text of the given page. |
width | Page width in pixels. |
height | Page height in pixels. |
rectangles | Bounding boxes of each text extracted character. |
errorCode | The code indicating the error inside the text extraction routine or data. |
errorDescription | Details of the error inside the text extraction routine or data. |
Example |
Copy Code
|
---|---|
URL:.. PCC.ashx/Document/q/2-2/Text?DocumentID=ecwBhAG0AcABsAGUALgBkAG8AYwA1 |
Example Response |
Copy Code
|
---|---|
{"pages":[{"number": 2,"text":"Page 3 of Document\n","width":612,"height":792,"rectangles":[[195.3,189.24,15.89,32.28],[211.19,189.24,13,32.28],[224.19,189.24,13,32.28],[237.19,189.24,11.49,32.28],[248.68,189.24,6.5,32.28],[255.18,189.24,13,32.28],[268.18,189.24,6.5,32.28],[274.68,189.24,13,32.28],[287.68,189.24,8.68,32.28],[296.36,189.24,6.5,32.28],[302.86,189.24,18.77,32.28],[321.63,189.24,13,32.28],[334.63,189.24,11.49,32.28],[346.13,189.24,14.4,32.28],[360.53,189.24,21.68,32.28],[382.21,189.24,11.49,32.28],[393.71,189.24,14.4,32.28],[408.11,189.24,8.66,32.28],[416.77,189.24,6.5,32.28]]}]} |
Http verb=GET URL:... /PCC.ashx/License/ClientViewer
There is a license URL which the client JavaScript viewer control (pccViewer) must use to enable viewing. The information sent by the control must be present in the Web Tier. The query parameters sent to this URL must be passed onto the Imaging Service Tier (also referred to as the Proxy Server). Information is returned back to the client control to enable viewing. If this communication sequence is not done or fails in any matter, no document views will be possible.
Example |
Copy Code
|
---|---|
URL:... /PCC.ashx/License/ClientViewer?v=7.0&iv=3A2061AD-9E2FB81C-F811174D-724A1C57&p=24 |