Open Content
Docs homeNaviga web
  • Introduction
  • Overview
  • Key features
  • Meta data standards
  • Architecture
  • Open Content API
  • Headless and end-to-end CMS workflows
  • Use and explore
    • How does it work
    • Open Content Docker
    • OC REST API
    • Event logs
    • Replication
    • Open Content Notifier
    • New JSON API:s - CCA and Duppy
    • Terminology: Other backend services
    • Lab: upload
      • Curl for object upload
      • Environment
      • Lab 0: Configuration
      • Lab 1: Concept upload
      • Lab 2: Image upload
      • Lab 3: Article Upload
      • Lab 4: Search
      • Lab 5: Delete objects
      • Lab 6: Event sourcing using event log
  • Releases
    • Release documentation and admin guides
      • Open Content 2.3
    • New in OC 3.0 (draft)
      • Removed features in OC 3.0
  • XLibris Archive
    • Archive everything you ever created or published
    • Import content to XLibris
Powered by GitBook
On this page
Export as PDF
  1. Use and explore

Event logs

An overview of the eventlog and contentlog endpoints

PreviousOC REST APINextReplication

Last updated 5 years ago

The event log tells you what has happened after a last known event. Depending on your use-case you can either process the eventlog from the beginning (it keeps a history of one month), or start at the last event. It's useful to process all retained events if you want to prepopulate a cache, but if you just need it for invalidation of a cache that you start cold and build ad-hoc it makes more sense to start with the last event.

A request to the eventlog looks like this: GET If called without any query parameters you get events from the start of the log:

{
  "events": [
    {
      "id": 406362,
      "uuid": "f41c8f07-5992-5161-8ccf-c2347ee1c59c",
      "eventType": "ADD",
      "created": "2019-12-09T12:23:44.000Z",
      "content": {
        "uuid": "f41c8f07-5992-5161-8ccf-c2347ee1c59c",
        "version": 1,
        "created": "2019-12-09T12:23:44.000Z",
        "source": null,
        "contentType": "Image",
        "batch": false
      }
    },
    {
      "id": 406363,
      "uuid": "fc7710c3-1c9d-4df0-9a5f-c524774ef7de",
      "eventType": "ADD",
      "created": "2019-12-10T07:13:39.000Z",
      "content": {
        "uuid": "fc7710c3-1c9d-4df0-9a5f-c524774ef7de",
        "version": 1,
        "created": "2019-12-10T07:13:39.000Z",
        "source": null,
        "contentType": "Article",
        "batch": false
      }
    },
    ...
  ]
}
{
  "events": [
    {
      "id": 406375,
      "uuid": "b73de3be-8b94-4c0f-9f6e-b058d077805f",
      "eventType": "ADD",
      "created": "2019-12-19T12:09:35.000Z",
      "content": {
        "uuid": "b73de3be-8b94-4c0f-9f6e-b058d077805f",
        "version": 1,
        "created": "2019-12-19T12:09:35.000Z",
        "source": null,
        "contentType": "Article",
        "batch": false
      }
    },
    {
      "id": 406376,
      "uuid": "f9f87e70-a0d7-4bc8-b2d4-5fab82760839",
      "eventType": "UPDATE",
      "created": "2019-12-19T12:11:13.000Z",
      "content": {
        "uuid": "f9f87e70-a0d7-4bc8-b2d4-5fab82760839",
        "version": 6,
        "created": "2019-12-19T12:00:34.000Z",
        "source": null,
        "contentType": "Article",
        "batch": false
      }
    },
    ...
  ]
}
<?xml version="1.0" encoding="UTF-8"?>
<newsItem conformance="power" guid="f9f87e70-a0d7-4bc8-b2d4-5fab82760839" standard="NewsML-G2" standardversion="2.20" version="1"
  xmlns="http://iptc.org/std/nar/2006-10-01/">
  <catalogRef href="http://www.iptc.org/std/catalog/catalog.IPTC-G2-Standards_27.xml"/>
  <catalogRef href="http://infomaker.se/spec/catalog/catalog.infomaker.g2.1_0.xml"/>
  <itemMeta>
    <itemClass qcode="ninat:text"/>
    <provider literal="InfomakerConfig"/>
    <versionCreated>2019-12-19T12:11:13Z</versionCreated>
    <firstCreated>2019-12-19T12:00:34Z</firstCreated>
    <pubStatus qcode="imext:draft"/>
    <title>kkkk</title>
    <itemMetaExtProperty type="imext:type" value="x-im/article"/>
    <itemMetaExtProperty type="imext:haspublishedversion" value="false"/>
    <links
      xmlns="http://www.infomaker.se/newsml/1.0">
      <link rel="creator" title="Tryout Tryout" type="x-imid/user" uri="imid://user/sub/b911d79b-42c9-48cd-85cf-be5b1824a1fc"/>
      <link rel="subject" title="Accident and emergency incident" type="x-im/category" uuid="5e5e0695-3a21-47e9-87d3-f6bfa5791e46">
...

The contentlog event id is not consistent when migrating to a new version/install of OC either (it gets "compacted"), so depending on it as state for long-running tasks is not recommended.

If you pass in a negative value, like so GET , you get the last -N events in the log.

The id attribute in the events can be used to paginate though the eventlog. So if we have processed events up until 406374 we would ask the eventlog for all events after it, like so GET :

To fetch the updated object the normal objects endpoint is used GET

To get a log that covers all content in OC you must use the contentlog instead (). It comes with some other trade-offs though as it only contains the last event for every object and it doesn't publish any delete events. That means that it is useful for bootstrapping f.ex. a cache with a full data set, but not very useful for invalidation.

https://oc.tryout.infomaker.io:8443/opencontent/eventlog
https://oc.tryout.infomaker.io:8443/opencontent/eventlog?event=-2
https://oc.tryout.infomaker.io:8443/opencontent/eventlog?event=406374
https://oc.tryout.infomaker.io:8443/opencontent/objects/f9f87e70-a0d7-4bc8-b2d4-5fab82760839?version=6
https://oc.tryout.infomaker.io:8443/opencontent/contentlog