Versioning is one of the two mechanisms by which an external system can only retrieve new or changed data from Datagate (the other being SetExported). It works on a simple principle: each record has a date of the last change, and the client asks "give me everything that has changed since date X".
It's the simplest mechanism to implement — it doesn't require explicit tagging, it doesn't require client-side status management. It is enough to remember the last version received and send it to the next request.
Each record in Datagate has a Record Version field which is actually the date of the last change, converted to milliseconds from January 1, 1970 (epoch Unix). When you request documents with FromVersion, you only receive records with a higher version — that is, those modified after that time.
Example: Get modified stock documents from January 2, 2023, 10:18 a.m.:
GET /DataExchange/TR/Stocks/GetList?FromVersion=1672654720366
If you need to convert between version (number) and date (for debugging or logging):
// Dată → Versiune (număr)
long RecordVersion = (LastChangedDate.Ticks - new DateTime(1970, 1, 1).Ticks)
/ TimeSpan.TicksPerMillisecond;
// Versiune (număr) → Dată
DateTime LastChangedDate = new DateTime(
Version * TimeSpan.TicksPerMillisecond + new DateTime(1970, 1, 1).Ticks);
Each record has audit fields that track who created, modified, validated, or canceled the document. These fields apply only at the header level — there is no separate version on the lines of a document.
| Field | Applies to | Meaning |
|---|---|---|
| Create Date | Master data, documents | When it was created |
| Create By | Master data, documents | Who created it |
| Last Changed Date | Master data, documents | Last Modified (= Record Version) |
| Last Changed By | Master data, documents | Who last edited |
| Validated Data | Documents only | When it was validated (issued) |
| Validated By | Documents only | Who validated |
| Canceled Date | Documents only | When it was canceled |
| Canceled By | Documents only | Who canceled |
Both mechanisms serve the same purpose — incremental data retrieval — but fit in different scenarios:
| Versioning | SetExported | |
|---|---|---|
| Simplicity | Simpler — no status management | More complex — requires explicit markup |
| Control | Less control — time-based | More control — per document, per flow |
| Multiple streams | Single flow per endpoint | Same document, different streams |
| Recommended for | Simple, single-consumer synchronizations | Complex integrations, multiple consumers |