Event logs

An overview of the eventlog and contentlog endpoints

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: GEThttps://oc.tryout.infomaker.io:8443/opencontent/eventlog 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
      }
    },
    ...
  ]
}

If you pass in a negative value, like so GET https://oc.tryout.infomaker.io:8443/opencontent/eventlog?event=-2, 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 https://oc.tryout.infomaker.io:8443/opencontent/eventlog?event=406374:

{
  "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
      }
    },
    ...
  ]
}

To fetch the updated object the normal objects endpoint is used GET https://oc.tryout.infomaker.io:8443/opencontent/objects/f9f87e70-a0d7-4bc8-b2d4-5fab82760839?version=6

<?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">
...

To get a log that covers all content in OC you must use the contentlog instead (https://oc.tryout.infomaker.io:8443/opencontent/contentlog). 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.

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.

Last updated