DocumentationViewpointCore services

Core Services

This page describes the REST API. To work with documents by hand, use the web app instead; see Search and view documents and Settings.

Access to Viewpoint’s core services is managed through its REST API, beginning with the “/auth/token” endpoint to retrieve an access token. This token must be included as a Bearer token in the Authorization header for all subsequent requests.

CRUD operations

Discover Schemas

/v1/document/schemas

Upload Document

/v1/document/{schema}/{userid}/upload

Search Documents

/v1/document/{schema}/{userid}/search

Download Document

/v1/document/{schema}/{userid}/download/{documentId}

Patch Document Metadata

/v1/document/{schema}/{userid}/{partitionKey}/{documentId}

The following patch operations are supported for the different data types supported by Viewpoint:

Data type \ Patch operation typeAddRemoveReplace
StringSupportedSupportedSupported
Array of stringsDo Replace of whole arraySupportedSupported
Complex objectSupportedSupportedSupported
Array of complex objectsDo Replace of whole arraySupportedSupported
BooleanSupportedSupportedSupported

Delete document

/v1/document/{schema}/{userid}/{partitionKey}/{documentId}

Composed operations

Viewpoint also supports combined operations for enhanced efficiency:

Search and Download

/v1/document/{schema}/{userid}/searchanddownload/{column}/{value}

Search and Patch

/v1/document/{schema}/{userid}/searchandpatch

See the Patch Document Metadata section for details on patch operations.

Search and Delete

/v1/document/{schema}/{userid}/searchanddelete/{column}/{value}

These operations allow for quicker execution of multiple tasks in a single request, provided the search returns exactly one result.

Advanced Features

Appendices

Viewpoint allows multiple document blobs to be associated with a single database row. This is particularly useful in scenarios such as document signing processes where additional blobs (e.g., signed data) may be associated with a primary document.

Array Metadata

Viewpoint supports the storage of array data in database rows, which can be useful when searching for complex document content, such as lists or reports within a document.

The data in the array can be of type string or complex object (named string values).

Object/Complex Metadata types

Besides simple data types like string and boolean, Viewpoint also supports complex/objects as metadata data types. A complex/object is a set of named values. Each value in the object must be of type string. This is useful when storing metadata with different meanings like:

{
  "Approver": {
    "Type": "Email",
    "Value": "john.doe@example.com"
  }
}
 
{
  "Approver": {
    "Type": "PhoneNumber",
    "Value": "+46123456789"
  }
}
 

Load actions

In the Viewpoint schema an attribute can be associated with a load action. A load action is a transformation that is done on the metadata before loading it to the database. There are two load actions available:

  • To upper - transforms the data to upper case
  • To lower - transforms the data to lower case

Load actions can be defined on the following metadata data types:

  • string
  • array of strings
  • array of complex objects (string values)

When an attribute has a load action defined, the Viewpoint load service will add an attribute named attributeName.ToUpper or attributeName.ToLower with the transformed value to the metadata before saving it to the database.

Patching values with load actions

When patching metadata, if an attribute has a load action defined and is of type string (neither arrays nor objects are handled), the Viewpoint patch service will apply the load action transformation to the patched value before saving it to the database.

Document blobs, document types

Viewpoint supports the storage of any document type. Simply specify the correct ContentType when uploading the document blob.

Additional Capabilities

Besides the regular features described above there are some extra services available at your convenience:

Metadata Validation and Debugging

The service includes endpoints for metadata validation, as well as debugging tools to simulate various error codes and test client error-handling mechanisms.

Metadata Export

An endpoint (/utils/getexportedmetadata/{pointInTime}) is available to get metadata that is exported during maintenance (if configured), allowing for robust document management.

Audit log Export

An endpoint (/utils/getauditlogs/{pointInTime}) is available to get the audit logs from the point in time of your interest. The audit logs are exported during maintenance and made available as zipped csv files for further analysis.

Authorization

Clients are granted access with specific rights (Read, Write, Admin) based on schema definitions. The Admin right is reserved for clients performing maintenance operations.

Schemas

The Schema defines the structure of your document metadata, specifying columns as strings, booleans, objects/complex types, or arrays. Multiple Schemas can be defined in the system to cater to varying client requirements, including different authorization rules. Each Schema is tailored to your organizational needs.

Even though the CosmosDB is a document database and you can add metadata outside of the Schema, the Schema is used to enforce the quality of the metadata.

Besides validating the metadata the schema service can also:

  • add default values to metadata
  • enforce required fields when doing searches
  • transform data when doing loading and saving of metadata (transform data to upper or lower case)

Clients integrating with Viewpoint can discover available Schemas via the /v1/document/schemas endpoint.

Seen in the web app

The web app reads the same archive. The hit list on Search shows the columns that the schema defines, and the View menu lists the Original document and its appendices. Update Columns in Settings reads the schema again when it has changed. See Search and view documents and Settings.