DocumentationPagesArchive

Archive

The Archive calls let your system store, find and change documents in the Viewpoint archive that is connected to your environment. Pages forwards each call to Viewpoint and adds the checks that keep your documents apart from those of other companies.

The common parts of every call, such as the path, the token and the response codes, are on Calling the Pages API. Paths on this page leave out the optional environment group.

Before you start

  • The environment needs a Viewpoint connection in CenterPoint. When Pages cannot read it, the calls fail with error (063), (064) or (065). When it is missing, they fail with 500.
  • Every call except the schema list takes a {schema}, the name of a Viewpoint schema, and a {userId}, the user id that Pages passes on to Viewpoint. The schema list tells you which schemas you can use.
  • When your company uses the shared Viewpoint archive, Pages keeps your documents separate. On upload it stamps each document with your company, environment and environment group. On search, download and patch it only reaches documents with those values. Filters of your own on these fields are replaced, and the company value is left out of results. A patch cannot change these fields. A private archive has no extra filter.

The calls

CallUse
GET /{customerEnvironment}/archive/schemasList the schemas available to your company.
POST /{customerEnvironment}/archive/search/{schema}/{userId}Search for documents with the search model in the body.
GET /{customerEnvironment}/archive/download/{schema}/{userId}/{documentId}Download a document.
POST /{customerEnvironment}/archive/upload/{schema}/{userId}Upload a document.
PATCH /{customerEnvironment}/archive/patch/{schema}/{userId}/{partitionKey}/{id}Change the metadata of a document.

List schemas

The response is a list of schema models. Each has a Name, a PartitionKey, the Columns of the schema and its RetentionPolicies.

The body is a search model. A small search looks like this:

{ "Take": 10, "Skip": 0 }

The search model also takes Columns, Chainer, Sorter, groupings and more, exactly as in Viewpoint. See Core services and the API reference. The response has the matching documents in DocumentModel, a Count, and a ResponseContinuation value for the next page.

Download

The response is the file. A PDF is returned as .pdf, and any other content type as .bin. In the shared archive, the call returns 404 when the document does not belong to your company, environment and environment group.

Upload

The body has these fields:

FieldMeaning
FileThe document as a base64 string.
ContentTypeThe content type of the file, for example application/pdf.
MetadataThe metadata of the document, as a JSON object that follows the schema.
RetentionPolicy, RetentionStartDate, ArchiveDateThe retention and archive dates.
ImportFromOtherArchivingSystem, SignedDataFlags, as in Viewpoint.

The response is the stored document, with its id and PartitionKey. Use them to patch the document.

Patch

The body is a JSON Patch document, a list of operations with op, path and value. Each path names a metadata field of the schema:

[ { "op": "replace", "path": "/Reference", "value": "order-10042" } ]

The supported operations are the ones in Core services. A patch that touches the company, environment or environment group fields, or the whole document, is refused with 400. In the shared archive, the call returns 404 when the document does not belong to your company, environment and environment group.

Errors

The status code of a Viewpoint failure is passed on to you, with a Message that starts with (055). Errors (063), (064) and (065) mean that Pages could not read the archive settings or the Viewpoint connection from CenterPoint. See Error codes.