Navbar Apiicon Event Data API

10Duke Event Data API v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Send and read events

Base URLs:

Web: 10Duke Software

event

Put one or more events

Code samples

# You can also use wget
curl -X POST https://example.event.10duke.com/put \
  -H 'Content-Type: application/jose' \
  -H 'Accept: application/json'

POST https://example.event.10duke.com/put HTTP/1.1
Host: example.event.10duke.com
Content-Type: application/jose
Accept: application/json

var headers = {
  'Content-Type':'application/jose',
  'Accept':'application/json'

};

$.ajax({
  url: 'https://example.event.10duke.com/put',
  method: 'post',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const fetch = require('node-fetch');
const inputBody = 'eyJhbGciOiJSUzI1NiJ9.eyJldmVudFNvdXJjZUlkIjoibXktYXBwbGljYXRpb24iLCJldmVudElkIjoiNjRkNDY4NjMtNWU3MS00ZTU2LTgxZjktMzVjNjk3MjM3N2UxIiwiZGF0YSI6eyJpcEFkZHJlc3MiOiIxMi4xMy4xNC4xNSIsInVzZXJJZCI6IjBmNThhYTdhLWMxMGEtNDgzNS1hNGQ1LTQzMWEyMWQzNGE1OSIsImVtYWlsIjoiam9obi5zbWl0aEBleGFtcGxlLmNvbSJ9LCJldmVudFR5cGUiOiJsb2dpbiJ9.h1WiA6B5Gwu_uUo2LWMb9ZFbiVwIeGxScunb8iO2cvadvWxClqtERIbRKfCZKN9g1H4s9HSx5ViHsXx9YafM_NcB-vvA1-7CHgSb172ydRIwttVg8OEburqGSWmZyzZQLsWkWMm6FHypUOglLF23sQfGTuf8jw1jJFt31qe9JoHVPPOKTWW1lubkeQsWFBEtjGdrHt6EqBIzoPdfv0gQg_H6NJP3mY5Kh_JCrA5t88T_XhIREeXe8DSnuhtjixeV6d3cmnrNKfkujGIZv2T8Jap5T5djbehUU7x83zJIEOioqaGTgMmUeNFpIJS5OZL1fsXeHKUmpY4ALpt2OCSZOw';
const headers = {
  'Content-Type':'application/jose',
  'Accept':'application/json'

};

fetch('https://example.event.10duke.com/put',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/jose',
  'Accept' => 'application/json'
}

result = RestClient.post 'https://example.event.10duke.com/put',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/jose',
  'Accept': 'application/json'
}

r = requests.post('https://example.event.10duke.com/put', params={

}, headers = headers)

print r.json()

URL obj = new URL("https://example.event.10duke.com/put");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /put

Stores event data carried by the request in the event data storage

Body parameter

JWS (JSON Web Signature) containing a single event, i.e. the JWS body is a single JSON object describing the example event. The example event represents a user login in a system connected to the Event Data service.

eyJhbGciOiJSUzI1NiJ9.eyJldmVudFNvdXJjZUlkIjoibXktYXBwbGljYXRpb24iLCJldmVudElkIjoiNjRkNDY4NjMtNWU3MS00ZTU2LTgxZjktMzVjNjk3MjM3N2UxIiwiZGF0YSI6eyJpcEFkZHJlc3MiOiIxMi4xMy4xNC4xNSIsInVzZXJJZCI6IjBmNThhYTdhLWMxMGEtNDgzNS1hNGQ1LTQzMWEyMWQzNGE1OSIsImVtYWlsIjoiam9obi5zbWl0aEBleGFtcGxlLmNvbSJ9LCJldmVudFR5cGUiOiJsb2dpbiJ9.h1WiA6B5Gwu_uUo2LWMb9ZFbiVwIeGxScunb8iO2cvadvWxClqtERIbRKfCZKN9g1H4s9HSx5ViHsXx9YafM_NcB-vvA1-7CHgSb172ydRIwttVg8OEburqGSWmZyzZQLsWkWMm6FHypUOglLF23sQfGTuf8jw1jJFt31qe9JoHVPPOKTWW1lubkeQsWFBEtjGdrHt6EqBIzoPdfv0gQg_H6NJP3mY5Kh_JCrA5t88T_XhIREeXe8DSnuhtjixeV6d3cmnrNKfkujGIZv2T8Jap5T5djbehUU7x83zJIEOioqaGTgMmUeNFpIJS5OZL1fsXeHKUmpY4ALpt2OCSZOw

Parameters

Parameter In Type Required
body - A single event as a JSON object or multiple events as a JSON array. For security and integrity reasons, the event(s) must be wrapped in a JWS (JSON Web Signature) envelope. JWS must be signed using one of the following JWS signature algorithms: RS256, RS384 or RS512. body Jws­Event­Data true

Example responses

default Response

{
  "error": "string",
  "error_description": "string",
  "error_uri": "string"
}

Responses

Status Meaning Description Schema
201 Created Empty response if handled successfully None
default Default Unexpected error Api­Error

Read events stored in the event data service by an external system

Code samples

# You can also use wget
curl -X GET https://example.event.10duke.com/get/{eventSourceId} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'

GET https://example.event.10duke.com/get/{eventSourceId} HTTP/1.1
Host: example.event.10duke.com
Accept: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.

var headers = {
  'Accept':'application/json',
  'Authorization':'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'

};

$.ajax({
  url: 'https://example.event.10duke.com/get/{eventSourceId}',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'

};

fetch('https://example.event.10duke.com/get/{eventSourceId}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'
}

result = RestClient.get 'https://example.event.10duke.com/get/{eventSourceId}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'
}

r = requests.get('https://example.event.10duke.com/get/{eventSourceId}', params={

}, headers = headers)

print r.json()

URL obj = new URL("https://example.event.10duke.com/get/{eventSourceId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /get/{eventSourceId}

Reads events sent by system identified by the given eventSourceId from the event data storage, filtering and sorting by event timestamp

Parameters

Parameter In Type Required
after - Limits returned events to events received after this timestamp. The value is in nanoseconds since the Epoch (1970-01-01T00:00:00Z). query integer(int64) false
before - Limits returned events to events received before this timestamp. The value is in nanoseconds since the Epoch (1970-01-01T00:00:00Z). query integer(int64) false
maxEventCount - Maximum number of events to return. It is strongly recommended to always specify this parameter, and use paging to return events in chunks of tens (e.g. maxEventCount=10) to tens of thousands (e.g. maxEventCount=10000). query integer(int32) false
minWaitMs - Minimum time to wait (in milliseconds) before returning, unless maxEventCount is reached earlier. This parameter can be used with after for long polling new events to reduce number of requests and get a response as soon as maxEventCount is reached. query integer(int32) false
maxWaitMs - Maximum time to wait (in milliseconds) for at least one event to return. This parameter can be used with after for long polling new events to get a response as soon as event has been received by the event data service. query integer(int32) false
newest - When used with maxEventCount, decides if the events to return are the newest or the oldest events of the result range. Default is true. query boolean false
Authorization - JSON Web Token (JWT) for authorizing the operation. In most cases this is required. header Authorization­Header­Value false
eventSourceId - Identifier of system that produced the event path string true

Example responses

Response content with just one event, specifically the example event used in examples for /put

{
  "uri": "my-application",
  "updateUrl": "my-application?after=1576056175969002022",
  "count": 1,
  "objects": [
    {
      "instruction": "older",
      "count": 0,
      "eventType": "instruction",
      "url": "my-application?before=1576056175969002022"
    },
    {
      "eventSourceId": "my-application",
      "eventId": "64d46863-5e71-4e56-81f9-35c6972377e1",
      "data": {
        "ipAddress": "12.13.14.15",
        "userId": "0f58aa7a-c10a-4835-a4d5-431a21d34a59",
        "email": "john.smith@example.com"
      },
      "eventReceived_str": "1576056175969002022",
      "eventType": "login",
      "eventReceived": 1576056175969002000
    },
    {
      "instruction": "newer",
      "count": 0,
      "eventType": "instruction",
      "url": "my-application?after=1576056175969002022"
    }
  ]
}

default Response

{
  "error": "string",
  "error_description": "string",
  "error_uri": "string"
}

Responses

Status Meaning Description Schema
200 OK Response of a /get request. First item of the objects array is always an instruction for accessing older events, next items are the actual events, and last item is an instruction for accessing newer events. Feed
default Default Unexpected error Api­Error

Code samples

# You can also use wget
curl -X GET https://example.event.10duke.com/get/{eventObjectType}/{eventObjectId} \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'

GET https://example.event.10duke.com/get/{eventObjectType}/{eventObjectId} HTTP/1.1
Host: example.event.10duke.com
Accept: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.

var headers = {
  'Accept':'application/json',
  'Authorization':'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'

};

$.ajax({
  url: 'https://example.event.10duke.com/get/{eventObjectType}/{eventObjectId}',
  method: 'get',

  headers: headers,
  success: function(data) {
    console.log(JSON.stringify(data));
  }
})

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json',
  'Authorization':'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'

};

fetch('https://example.event.10duke.com/get/{eventObjectType}/{eventObjectId}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'Authorization' => 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'
}

result = RestClient.get 'https://example.event.10duke.com/get/{eventObjectType}/{eventObjectId}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0.'
}

r = requests.get('https://example.event.10duke.com/get/{eventObjectType}/{eventObjectId}', params={

}, headers = headers)

print r.json()

URL obj = new URL("https://example.event.10duke.com/get/{eventObjectType}/{eventObjectId}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /get/{eventObjectType}/{eventObjectId}

Reads events related to the given eventObjectType/eventObjectId identifier from the event data storage, filtering and sorting by event timestamp

Parameter In Type Required
after - Limits returned events to events received after this timestamp. The value is in nanoseconds since the Epoch (1970-01-01T00:00:00Z). query integer(int64) false
before - Limits returned events to events received before this timestamp. The value is in nanoseconds since the Epoch (1970-01-01T00:00:00Z). query integer(int64) false
maxEventCount - Maximum number of events to return. It is strongly recommended to always specify this parameter, and use paging to return events in chunks of tens (e.g. maxEventCount=10) to tens of thousands (e.g. maxEventCount=10000). query integer(int32) false
minWaitMs - Minimum time to wait (in milliseconds) before returning, unless maxEventCount is reached earlier. This parameter can be used with after for long polling new events to reduce number of requests and get a response as soon as maxEventCount is reached. query integer(int32) false
maxWaitMs - Maximum time to wait (in milliseconds) for at least one event to return. This parameter can be used with after for long polling new events to get a response as soon as event has been received by the event data service. query integer(int32) false
newest - When used with maxEventCount, decides if the events to return are the newest or the oldest events of the result range. Default is true. query boolean false
Authorization - JSON Web Token (JWT) for authorizing the operation. In most cases this is required. header Authorization­Header­Value false
eventObjectType - Type of object for which related events are requested path string true
eventObjectId - Id of object for which related events are requested path string true

Example responses

Response content with just one event, specifically the example event used in examples for /put

{
  "uri": "my-application",
  "updateUrl": "my-application?after=1576056175969002022",
  "count": 1,
  "objects": [
    {
      "instruction": "older",
      "count": 0,
      "eventType": "instruction",
      "url": "my-application?before=1576056175969002022"
    },
    {
      "eventSourceId": "my-application",
      "eventId": "64d46863-5e71-4e56-81f9-35c6972377e1",
      "data": {
        "ipAddress": "12.13.14.15",
        "userId": "0f58aa7a-c10a-4835-a4d5-431a21d34a59",
        "email": "john.smith@example.com"
      },
      "eventReceived_str": "1576056175969002022",
      "eventType": "login",
      "eventReceived": 1576056175969002000
    },
    {
      "instruction": "newer",
      "count": 0,
      "eventType": "instruction",
      "url": "my-application?after=1576056175969002022"
    }
  ]
}

default Response

{
  "error": "string",
  "error_description": "string",
  "error_uri": "string"
}
Status Meaning Description Schema
200 OK Response of a /get request. First item of the objects array is always an instruction for accessing older events, next items are the actual events, and last item is an instruction for accessing newer events. Feed
default Default Unexpected error Api­Error

Schemas

AuthorizationHeaderValue

"Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzU5ODY0MTUsImlhdCI6MTU3NTAzMTY5NiwibXktZmVlZCI6dHJ1ZX0."

NOTE! JWT / JWS signature is omitted from the example value. In actual value, the Base64 encoded signature comes after the last dot.

The value must start with string Bearer, followed by a single space and a JSON Web Token (JWT) for authorizing the operation. Generally, a JWT consists of header, body and signature. Each part is Base64 encoded and the parts are separated by dots.

EventFeedItem

{
  "eventType": "string"
}

Common fields for event feed items. Feed items include the actual events and instructions that can be used for reading older and newer events (paging).

Properties

Property Type Required
eventType - Type of the event string false

Event

{
  "eventType": "string",
  "eventSourceId": "string",
  "eventId": "string",
  "eventReceived": 0,
  "eventObjectId": "string",
  "eventObjectType": "string"
}

Common event root level fields. In addition to fields described here, an event can contain any fields. However, it is recommended that an event has just one additional field named data to contain the actual event data.

Properties

allOf

Property Type Required
anonymous - Common fields for event feed items. Feed items include the actual events and instructions that can be used for reading older and newer events (paging). Event­Feed­Item false

and

Property Type Required
anonymous - none object false
» eventSourceId - Identifier of system that produced the event. The value must not contain a forward slash because forward slash is used as a separator when reading objects from feeds. string false
» eventId - Unique id of the event. If not specified for an event sent to /put, generated by the event data service. string(uuid) false
» eventReceived - Event received timestamp, in nanoseconds since the Epoch (1970-01-01T00:00:00Z). The value is always generated by the event data service and must not be specified for an event sent to /put. integer(int64) false
» eventObjectId - Unique id of an object related to the event, or any other event reference. The value must not contain a forward slash because forward slash is used as a separator when reading objects from feeds. string false
» eventObjectType - Type of an object related to the event, or any other event reference. The value must not contain a forward slash because forward slash is used as a separator when reading objects from feeds. string false

EventFeedInstruction

{
  "eventType": "string",
  "url": "http://example.com",
  "instruction": "older",
  "count": 0
}

Event feed instruction that describes how to access items that are older or newer than items currently included in the feed (paging)

Properties

allOf

Property Type Required
anonymous - Common fields for event feed items. Feed items include the actual events and instructions that can be used for reading older and newer events (paging). Event­Feed­Item false

and

Property Type Required
anonymous - none object false
» url - Relative URL referring to the instruction target string(uri) false
» instruction - Describes the instruction. older is used for accessing older events, newer is used for accessing newer events. string false
» count - Number of older or newer events available. If not specified or null, number of available events is unknown. -1 means that there is at least one event available, but the exact amount is unknown. 0 or a positive integer is the exact number of events available. integer(int32) false

Enumerated Values

Property Value
instruction older
instruction newer

Feed

{
  "uri": "http://example.com",
  "updateUrl": "http://example.com",
  "count": 0,
  "objects": [
    {
      "eventType": "string",
      "url": "http://example.com",
      "instruction": "older",
      "count": 0
    }
  ]
}

Properties

Property Type Required
uri - Relative feed uri string(uri) false
updateUrl - URL that can be used for requesting update string(uri) false
count - Number of events in the objects array. Instruction items are not included, and the total number of items in objects is count + 2. integer(int32) false
objects - The feed items. First item is always an instruction for accessing older events, next items are the actual events, and last item is an instruction for accessing newer events. [any­Of] false

anyOf

Property Type Required
» anonymous - Event feed instruction that describes how to access items that are older or newer than items currently included in the feed (paging) Event­Feed­Instruction false

or

Property Type Required
» anonymous - Common event root level fields. In addition to fields described here, an event can contain any fields. However, it is recommended that an event has just one additional field named data to contain the actual event data. Event false

JwsEventData

"string"

JWS (JSON Web Signature) structure, where the JWS body can contain either a single event as a JSON object, or one to multiple events as a JSON array. Supported signature algorithms are: RS256, RS384 or RS512.

See the Event schema for structure of an event in the JWS body. The JWS header requires only the alg header field describing the signature algorithm.

ApiError

{
  "error": "string",
  "error_description": "string",
  "error_uri": "string"
}

Properties

Property Type Required
error - The error code string true
error_description - Error description for human audience string false
error_uri - URI for further information about the error string false