Blog archive

FCS API - Synchronizing Transactions

The best method for synchronizing fuel transactions is to use Reference API Call.

  • Use API call “Reference” to fetch your data.
    • All transactions are initially inserted to Gatex server with the Reference “N”.
    • You will call the Reference API by setting the timestamp and number of records. For example 200 records.
    • Then you will use POST method of the same API. This method will update the reference of the “DOWNLOADED” transactions to “S” to avoid fetching them again on the next API call.
    • Then you repeat the first step: call the Reference API by setting the same timestamp and number of records.
    • You repeat the loop until no transaction is left to receive in this calling session.
    • The next day, when your code runs the above loops, any newly arrived transaction is with Reference “N” regardless of its timestamp.

So, by fetching N transactions, there will be no missed one.

 

GET API Call:

api.gatex.ai/fcs/FCS/Reference?key=API-Key&dateTime=2024-08-29T00:00:00&limit=200

curl -X 'GET' \
  'https://api.gatex.ai/fcs/FCS/Reference?key=API-Key&limit=200' \
  -H 'accept: */*'

Response:

[
    {
        "Id": 6595821,
        "Reference": "N",
        "SequenceId": 39833,
        "Meter": "DT22",
        "SecondaryTag": "",
        "Operator": "34937",
        "Asset": "PL42998",
        "AccumulatorType": "O",
        "Sitecode": "EM",
        "Project": "EM825",
        "PlateNo": "42998",
        "Master": "DT22 Master Tag",
        "Accumulator": 362521,
        "Volume": 31.76,
        "Type": "Rented",
        "StartTime": "2024-08-29T10:10:19",
        "EndTime": "2024-08-29T10:11:10",
        "Status": "E",
        "ServerTimestamp": "2024-08-29T10:11:38",
        "UpdateTimestamp": null
    }...

]

Post API Call:

curl -X 'POST' \
  'https://api.gatex.ai/fcs/FCS/Reference?key=API-Key' \
  -H 'accept: */*' \
  -H 'Content-Type: application/json' \
  -d '[
  6595821,6595844
]'

Reponse:
2