- Created by Edward Notcutt on Oct 07, 2019
You are viewing an old version of this page. View the current version.
Compare with Current View Page History
Version 1 Current »
Overview
The Event service API is based on Eventstore technology which allows subscribers to get event notifications that have occurred in the Arken system. Most of these events are related to data changes such as when client data is updated or a new document is added.
The Event service gives the option to subscribers to access past events making sure no event is lost.
Client example
Example client code is provided which enforces long polling which maintains the last received event number and makes sure that no event is missed even if the client was down for some time.
Request - Get last event based on Account Hash Id only
GET /pre/event/info?accountHashId=xxxxxxxx HTTP/1.1 Host: api.nz.pre.arken.legal Accept: application/json Authorization: Bearer xxxxxx
Response - no events
HTTP/1.1 204 No Content Content-Type: application/json
Response - Get last event based on Account Hash Id only
HTTP/1.1 200 OK Date: Wed, 05 Dec 2018 03:17:06 GMT Content-Type: application/json Content-Length: 468 { "feedLink": "https://api.nz.pre.arken.legal/pre/event?accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&eventPositionFrom=88&rowsReturned=50&direction=backward", "lastEventNumber": 88, "lastEntryFeed": { "eventId": "d6491737-9800-409c-9764-b4ebb1f57272", "eventType": "FileStore.GetFileDetail", "eventNumber": 88, "eventDateTimeUtc": "2019-02-06T21:05:54.51426Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=checking pack-07-02-2019 10-05-49.zip", "properties": [ { "Key": "Description", "Value": "Checking Pack" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:05:53" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-05-49" }, { "Key": "DocumentType", "Value": "WILL-1" } ] } }
Request - Get events with paging
GET /pre/event?accountHashId=qzlVU5FB7Y7NNlHr7UOzr3& direction=forward& eventPositionFrom=70& rowsReturned=100 HTTP/1.1 Host: api.nz.pre.arken.legal Accept: application/json Authorization: Bearer xxxxxxxx
Response - no events
HTTP/1.1 204 No Content Content-Type: application/json
Response - Get events with paging
[ { "eventId": "d6491737-9800-409c-9764-b4ebb1f57272", "eventType": "FileStore.GetFileDetail", "eventNumber": 88, "eventDateTimeUtc": "2019-02-06T21:05:54.51426Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=checking pack-07-02-2019 10-05-49.zip", "properties": [ { "Key": "Description", "Value": "Checking Pack" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:05:53" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-05-49" }, { "Key": "DocumentType", "Value": "WILL-1" } ] }, { "eventId": "07fdd59e-20f6-4e8b-b202-37c4bdda1bee", "eventType": "FileStore.Upload", "eventNumber": 87, "eventDateTimeUtc": "2019-02-06T21:05:53.5242131Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=Checking Pack-07-02-2019 10-05-49.ZIP", "properties": [ { "Key": "Description", "Value": "Checking Pack" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-05-49" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentType", "Value": "WILL-1" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:05:53" } ] }, { "eventId": "4f5425aa-6ab7-4014-a2d2-4e4aba5cf519", "eventType": "DocumentData.Update", "eventNumber": 86, "eventDateTimeUtc": "2019-02-06T21:05:53.2420973Z", "link": "https://api.nz.pre.arken.legal/pre/documentdata?hashId=P6Rk4XMxaKcTp9BKep9v62", "properties": null }, { "eventId": "bd00ea49-3c9a-4c15-8dcc-80af7af9d3de", "eventType": "FileStore.GetFileDetail", "eventNumber": 85, "eventDateTimeUtc": "2019-02-06T21:05:30.6277022Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=assets and liabilities-07-02-2019 10-05-21.zip", "properties": [ { "Key": "Description", "Value": "Assets and Liabilities" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:05:26" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-05-21" }, { "Key": "DocumentType", "Value": "WILL-1" } ] }, { "eventId": "48c682a7-5009-429f-9f89-9ba6b2ed60cc", "eventType": "FileStore.Upload", "eventNumber": 84, "eventDateTimeUtc": "2019-02-06T21:05:29.7910956Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=Assets and Liabilities-07-02-2019 10-05-21.ZIP", "properties": [ { "Key": "Description", "Value": "Assets and Liabilities" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-05-21" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentType", "Value": "WILL-1" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:05:26" } ] }, { "eventId": "49ddb84b-559b-49e2-bb99-4abd86148dc2", "eventType": "DocumentData.Update", "eventNumber": 83, "eventDateTimeUtc": "2019-02-06T21:05:26.7830383Z", "link": "https://api.nz.pre.arken.legal/pre/documentdata?hashId=P6Rk4XMxaKcTp9BKep9v62", "properties": null }, { "eventId": "9660cc9d-37ec-4667-b6a0-b280411b2af7", "eventType": "FileStore.GetFileDetail", "eventNumber": 82, "eventDateTimeUtc": "2019-02-06T21:04:59.2741378Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=questionnaire-07-02-2019 10-04-46.zip", "properties": [ { "Key": "Description", "Value": "Questionnaire" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:04:57" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-04-46" }, { "Key": "DocumentType", "Value": "WILL-1" } ] }, { "eventId": "e649c80f-218c-4d4e-a8cb-0cd94d733d5e", "eventType": "FileStore.Upload", "eventNumber": 81, "eventDateTimeUtc": "2019-02-06T21:04:59.1415736Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=Questionnaire-07-02-2019 10-04-46.ZIP", "properties": [ { "Key": "Description", "Value": "Questionnaire" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-04-46" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentType", "Value": "WILL-1" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:04:57" } ] }, { "eventId": "19f8b6ea-5666-47a0-bfb6-dd4fd952a5c6", "eventType": "DocumentData.Update", "eventNumber": 80, "eventDateTimeUtc": "2019-02-06T21:04:57.771915Z", "link": "https://api.nz.pre.arken.legal/pre/documentdata?hashId=P6Rk4XMxaKcTp9BKep9v62", "properties": null }, { "eventId": "326a1d5a-0192-4272-bdaa-8b269d4e83ba", "eventType": "FileStore.GetFileDetail", "eventNumber": 79, "eventDateTimeUtc": "2019-02-06T21:04:10.3085383Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=draft pack-07-02-2019 10-04-05.zip", "properties": [ { "Key": "Description", "Value": "Draft Pack" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:04:08" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-04-05" }, { "Key": "DocumentType", "Value": "WILL-1" } ] }, { "eventId": "c0480c61-30d7-46db-ab30-a00154a2ce9b", "eventType": "FileStore.Upload", "eventNumber": 78, "eventDateTimeUtc": "2019-02-06T21:04:09.1719467Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=Draft Pack-07-02-2019 10-04-05.ZIP", "properties": [ { "Key": "Description", "Value": "Draft Pack" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-04-05" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentType", "Value": "WILL-1" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:04:08" } ] }, { "eventId": "e13e0573-d913-47c3-8400-f5196602c824", "eventType": "DocumentData.Update", "eventNumber": 77, "eventDateTimeUtc": "2019-02-06T21:04:08.9343217Z", "link": "https://api.nz.pre.arken.legal/pre/documentdata?hashId=P6Rk4XMxaKcTp9BKep9v62", "properties": null }, { "eventId": "b6c96854-1809-4adf-8f78-451c2bcacb7b", "eventType": "FileStore.GetFileDetail", "eventNumber": 76, "eventDateTimeUtc": "2019-02-06T21:03:35.6993754Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=checking pack-07-02-2019 10-03-31.zip", "properties": [ { "Key": "Description", "Value": "Checking Pack" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:03:35" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-03-31" }, { "Key": "DocumentType", "Value": "WILL-1" } ] }, { "eventId": "535b77ee-a4b3-4f70-8915-f83d6c450073", "eventType": "FileStore.Upload", "eventNumber": 75, "eventDateTimeUtc": "2019-02-06T21:03:35.4056392Z", "link": "https://api.nz.pre.arken.legal/pre/accountHashId=qzlVU5FB7Y7NNlHr7UOzr3&clientHashId=v1wLxsmtn4MmLdAAwl8Z30&key=Checking Pack-07-02-2019 10-03-31.ZIP", "properties": [ { "Key": "Description", "Value": "Checking Pack" }, { "Key": "DownloadDate", "Value": "07-02-2019 10-03-31" }, { "Key": "DownloadType", "Value": "ZIP" }, { "Key": "DocumentType", "Value": "WILL-1" }, { "Key": "DocumentFileCreatedDate", "Value": "2019/02/07 10:03:35" } ] }, { "eventId": "d1ac85de-c3b2-4890-b8c3-d6ed3c5a9623", "eventType": "DocumentData.Update", "eventNumber": 74, "eventDateTimeUtc": "2019-02-06T21:03:35.0028758Z", "link": "https://api.nz.pre.arken.legal/pre/documentdata?hashId=P6Rk4XMxaKcTp9BKep9v62", "properties": null }, { "eventId": "c6ae1b87-ab92-40b2-9860-163f1e4ad8fc", "eventType": "DocumentData.Update", "eventNumber": 73, "eventDateTimeUtc": "2019-02-06T21:03:20.3885112Z", "link": "https://api.nz.pre.arken.legal/pre/documentdata?hashId=P6Rk4XMxaKcTp9BKep9v62", "properties": null }, { "eventId": "093f06dd-8c30-4afa-a65b-113c2ee1381c", "eventType": "DocumentData.Update", "eventNumber": 72, "eventDateTimeUtc": "2019-02-06T21:03:14.987286Z", "link": "https://api.nz.pre.arken.legal/pre/documentdata?hashId=P6Rk4XMxaKcTp9BKep9v62", "properties": null }, { "eventId": "3d997930-dd88-4145-bc3c-2cf492f9b73d", "eventType": "DocumentData.Update", "eventNumber": 71, "eventDateTimeUtc": "2019-02-06T21:03:14.4809286Z", "link": "https://api.nz.pre.arken.legal/pre/documentdata?hashId=P6Rk4XMxaKcTp9BKep9v62", "properties": null }, { "eventId": "4e02b7d2-8074-4298-ba03-c268814f08a4", "eventType": "DocumentData.Update", "eventNumber": 70, "eventDateTimeUtc": "2019-02-06T21:03:06.3405942Z", "link": "https://api.nz.pre.arken.legal/pre/documentdata?hashId=P6Rk4XMxaKcTp9BKep9v62", "properties": null } ]
Fetching Event Feeds and Code Examples
Below is an example on how you could poll the Event Api using System.Threading.Timers, WebClient and CancellationToken.
Attached here is the zipped full solution for your review:
Notes for this Example Code
- If you want to receive the entire event history, just delete the event.lastevent.txt file or change its contents to 0.
- If you want to receive the feed from a specific point, change the the event.lastevent.txt file content to an event point and re-run the application.
In this document:
- No labels