When an external system retrieves documents from Datagate (invoices, stock movements, orders), it needs to know which documents are new and which have already been retrieved. The SetExported mechanism solves exactly this problem: after a document is successfully retrieved, it is marked as "exported", and the next time it is synchronized, it no longer appears in the list of new documents.
This mechanism is the alternative to Versioning — both serve the same purpose (incremental retrieval of new documents), but work differently. SetExported gives you more control, because it explicitly marks every document, on every flow.
After the external system has successfully imported a document, call:
POST /DataExchange/TR/Stocks/SetExported
Parameters:
| Parameter | Meaning | Example |
|---|---|---|
| DocumentSeries | Document Series in Datagate | S-NR-RLV25 |
| DocumentNo | Document number | 30 |
| Interface | The name of the app that fetches | SAP |
| ExportType | Type of process | StockExport |
| ExportID | Document ID in the destination app | 132628542 |
InterfaceName and ExportType are important because the same document can be exported to multiple systems or in multiple streams. An invoice can be exported both to SAP (for accounting) and to a courier (for AWB) — each with its own InterfaceName and ExportType.
ExportID is optional but very useful: storing the ID in the destination system allows you to quickly identify the correspondence between the two systems.
GET /DataExchange/TR/Stocks/GetExport
| Parameter | Meaning |
|---|---|
| InterfaceName, ExportType | The same parameters as at SetExported — define "for whom" and "for what" we ask for |
| IncludeNotExported | If it is true, it returns only documents that have not yet been marked as exported |
| IncludeResend | Also includes documents that a user has manually marked with "Resend" |
| ExportDays | Number of days ago to search |
Each application returns a maximum of 10 documents. This limitation prevents timeouts on high volumes—the client must repeatedly call the endpoint until it receives an empty set.
There is no limit on requests per hour. The client can call the endpoint at any required frequency.