How to implement third-party services through REST API inside FIN

 


Exchange Data with REST API services

With FIN there are two possible solutions to exchange data with REST API.

1. The first one is to build a connector to read and write data based on technical information provided by the customer i.e. system details he wants to pull data from, authentication type and keys, data types (real time or historical data). Based on them, the Professional Service Team will quote the cost and the hourly rate for the service.

  • Alternatively, the customer can be trained with the quoted Developer Training to make the connector on his own, since in this case the knowledge of Fantom is required.

Pros:

  • Solid and secure solution

  • Flexible implementation

Cons:

  • More time and cost required

 

2. The second one is to use Axon Language to write ad-hoc functions in order to exchange data based on specific and defined parameters. The customer can be trained on Axon with the quoted Advanced Training. 

Pros:

  • Easier and faster to implement

  • Less cost

Cons:

  • Difficult to manage complex authentication methods

  • Small amount of data exchanged

  • Less deployable changes

Axon function example:

(writeData: false) => do usage: ioReadJson('http://external.service.example.com/api/data')->avgTemp writeTime: parseDataTime(now().toStr[0..16] + "00", "YYYY-MM-DDThh:mm:ss") dataSet: (ts: writeTime, val: usage).toGrid if(writeData == true) do dataSet.hisWrite(readById(@p:demo:r:1eeaf884-82cd6356)) commit(diff(readById(@p:demo:r:1eeaf884-82cd6356), {curVal:usage}, {transient})) end end

It is also possible to implement Haystack into the REST API Service in order to be able to utilize Haystack REST API services, already available into FIN (more information can be found here: https://project-haystack.org/doc/docHaystack/HttpApi).