You are viewing the Resources for the older version of JourneyApps (V3). JourneyApps V4 is the new default for all new apps since July 1, 2016.

Oplog

The JourneyApps API Oplog provides an ordered log of all create, update and delete operations that occurred on the cloud datastore for one of your JourneyApps applications. Polling the Oplog allows you to sync your own database with JourneyApps.

Relative URL HTTP Request Method
/api/v1/_oplog.format?start=x GET
/api/v1/_oplog.format?start=x&end=y&limit=z GET

Parameters

start and end specify the range of sequence IDs (see below for explanation) of the oplog to query. All entries with start <= sequence_id < end are returned.

limit is the limit of entries returned in a single API call. The default is 400, and the maximum is 1000 (subject to change).

Response

The response will contain a list of oplog entries no more than the limit. If there are no entries in the specified range, an empty array is returned.

Each entry contains the following info:

sequenceSequence ID — a strictly incrementing ID identifying the entry. Always greater than 0 and less than 2^63.
operationupdate (new or existing objects) or delete.
timestampTime when the write was made to the database.
typeThe object type.
idThe object id.
dataThe new state (attributes and relationships) of the object.

Polling

The oplog may be polled to monitor changes to the database. Polling should be performed at most once per second. To poll, the client must keep track of the latest sequence id returned. For the next query, that sequence id + 1 should be used in the start parameter.

Example

Retrieve the 5 first writes to the database.

Retrieve the next 5 writes.

Photos and Signatures (Attachments) from Oplog

It is sometimes necessary to sync photos and signatures (attachments) into your own database. Photos and signatures are binary data, and are therefore treated slightly differently. This function allows you to retrieve an attachment (photo or signature) by ID from the Oplog.

Relative URL HTTP Request Method
/api/v1/_attachment/attachment_id GET
Note: Replace attachment_id with the ID of the specific attachment found in a previous call to the Oplog (refer to the previous subsection of this page for details)

Response

A redirect to directly download the image file.

Note: This _attachment function returns the original raw image data (a redirect to the image file is performed). This differs from the Attribute Representation used in the rest of the JourneyApps API, which returns URLs for the attachments (photos and signatures) in various sizes.

Example

A previous call to the oplog returned the following result.

In the Oplog the attachment attribute named "photo" contains the ID of the attached image. To retrieve the image using that ID:

Previous Section Next Section