How do I fetch data from Floriday?
General
All resources of implemented modules should be synchronized between the application and Floriday in order to guarantee data consistency between the ERP and Floriday for users whereas some users work in the Floriday modules, ERP or other apps.
In order to keep data between Floriday and the application up-to-date it is recommended to use the synchronisation end points. For example, each time a new tradeItem is created, modified or deleted by a supplier, Floriday will increment the sequenceNumber of that record. These so called sequence numbers are unique for each model, such as tradeItem, supplyLine, etc.
By retrieving the sequenceNumber it is not necessary to retrieve all the data every time but only the changed records with a higher sequenceNumber. When the MaximumSequenceNumber
in the result is equal to the inserted SequenceNumber
the data is up to date.
Syncing for the first time
It is advised to start with maxSequence of "0" the first time you use the sync endpoints if you want to start over. This will ensure that everything is retrieved and eventually up to date. The steps you should take are:
- Start with a sequence of "0" when using the */GET/.../sync/{sequenceNumber=0};
- Process the received records and remember the highest provided sequenceNumber (=maxSequenceNumber);
- Use the remembered sequenceNumber when using the */GET/.../{sequenceNumber};
- Process the received records and remember the highest provided sequenceNumber again;
- Repeat until the
MaximumSequenceNumber
in the result is equal to provided sequenceNumber.
Or if you want to start over without historic data for some specific data you can choose to fetch the current maximum sequenceNumber and sync from here.
Continuous Synchronisation
For continuous synchronisation it is not necessary to keep using the maxSequence endpoint to check if you are up to date. By using the endpoint */GET/.../sync/{sequenceNumber} you receive the current sequence number and the current maxSequenceNumber. You are up to date when the received maxSequenceNumber is equal to the received sequenceNumber.
Why zero new results does not have to mean you are up to date!
In some cases it can happen that the Results are empty but the MaximumSequenceNumber is incremented, this is due to a filtering that happens in the sync endpoint itself. Customers for example, will experience filtering on Trade items and Supply lines are filtered by default on followed connections and optionally you can choose to also filter on SelectedTradeItems.
Interval
Depending on how quickly the retrieved data can be processed, interval timers can be set for example 1 - 5 minutes for endpoints which require near real time synchronization such as trade item and supply line retrieval for customers or sales order retrieval for suppliers. For the synchronization for less frequently changed endpoints such as delivery conditions or connections, an interval of twice or even once a day may be sufficient.
Updated about 1 year ago