Distribute and archive documents

These calls send a finished document to its receiver and store documents in an archive. They are part of the Pages API, so they use the same host, token and environment path as Create documents.

The host is api.webeditor-v4.metaforce.net. Every path starts with the environment, for example /Test/distribute/send.

Distribute a document

POST /distribute/send creates a document from your data and distributes it. Send it the same body as PDF and other outputs, with one extra optional field, Id, a value that follows the request through the distribution. For JSON data use POST /distribute/send/jsondata.

How the document is delivered is decided by the logic in the MetaFile together with the API. If the document index named DISTRIBUTION has the value CentralDistribution, Doc Gen checks whether the receiver has a digital mailbox and sends the document there. Sending to a digital mailbox needs a fallback print provider to be in place.

The call answers 202 with:

FieldWhat it is
CorrelationIdThe id of this distribution.
IdThe value you sent in Id.
DistributionHow the document was distributed.
JobId, DocIdThe ids of the document when it was loaded into Dynamo.

It can also answer 204, 406 and 429, as described on PDF and other outputs.

Send the same request only once

To protect against a request being sent twice, for example after a timeout, use the idempotent calls:

  • PUT /distribute/idempotent/send for XML data.
  • PUT /distribute/idempotentsend/jsondata for JSON data.

They take the same body plus an ExternalCorrelationId, a GUID that you create. Send the same GUID again for the same document and Doc Gen does not distribute it twice. The answer also has ExternalCorrelationId and RequestState.

Set a notification ready

PUT /distribute/setconotificationready/{correlationId} sets the notification of a distribution to ready. It answers 200, or 404 if the notification is not found.

Archive

The archive calls work against the ViewPoint archive that is connected to your company. They are available only when that connection is set up.

CallWhat it does
GET /archive/schemasLists the schemas available in the archive.
POST /archive/search/{schema}/{userId}Searches for documents with the search model in the body.
GET /archive/download/{schema}/{userId}/{documentId}Downloads a document.
POST /archive/upload/{schema}/{userId}Uploads a document.
PATCH /archive/patch/{schema}/{userId}/{partitionKey}/{id}Changes the metadata of a document with a JSON patch.

A patch that tries to change a field that Doc Gen uses to keep documents apart is answered with 400. A document that does not belong to your company is answered with 404.