Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

How does LiteFarm get a non-expiring token from the Ensemble API?

Probably manually enter this into an “integrations” table to similar to how certifiers have a surveystack link. Ensemble access tokens will expire. There is a refresh token for use when this happens.

Ultimately up to ESCI and the owner of LF-2483.

...

https://documenter.getpostman.com/view/18529342/UVXeqchj#b3a26ae9-be68-42a4-ac92-ca8025e7008c (assumed to be POST Create organization webhook)

Note

Details of the JSON response below may be out-of-date, and are subject to change.

Code Block
breakoutModewide
curl --location -g --request POST 'api.esci.io/organizations/{{organization_uuid}}/webhooks/' \
--data-raw '{
    "url": "http://www.example.com",
    "authorization_header": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX3BrIjoxLCJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiY29sZF9zdHVmZiI6IuKYgyIsImV4cCI6MTIzNDU2LCJqdGkiOiJmZDJmOWQ1ZTFhN2M0MmU4OTQ5MzVlMzYyYmNhOGJjYSJ9.NHlztMGER7UADHZJlxNG0WSi22a2KaYSfd1SAuT7lU",
    "frequency": 15
}


// Example json that webhook will post to the url
// [
//   {
//     "node_esid": "123",
//     "sensor_esid": "124",
//     "parameter_number": 1,
//     "unit": "ºC",
//     "time": [
//       "02-09-2022, 22:53:52",
//       "02-09-2022, 22:54:07"
//     ],
//     "value": [
//       1,
//       2
//     ],
//     "validated": [
//       false,
//       false
//     ]
//   },
//   {
//     "node_esid": "123",
//     "sensor_esid": "124",
//     "parameter_number": 2,
//     "unit": "kPa",
//     "time": [
//       "02-09-2022, 22:54:23"
//     ],
//     "value": [
//       3
//     ],
//     "validated": [
//       false
//     ]
//   }
// ]'

...

Do we need a different callback address for each organization or can the callback specify org as part of the hierarchy?

Each farm would have it’s own callback address with the farm_id or organization_id provided as one of the inputsWe will use a single callback address per integration partner, so there will be one for all organizations in ESCI communications. That address will identify the partner.

Does the callback only send what has happened since the last update? Is there a failsafe if a callback fails to communicate several rounds of data?

...

It appears to be based on “parameter_number”. Need to explore what exactly this means to ESCI.

Note

The following details are likely out-of-date, and are subject to change.

Code Block
   "node_esid":"123",
   "sensor_data":[
      {
         "sensor_esid":"124",
         "sensor_values":[
            {
               "parameter_number":1,
               "raw_value":2.910,
               "timestamp":"2022-01-10T17:41:00+0800"
            },
            {
               "parameter_number":1,
               "raw_value":2.110,
               "timestamp":"2022-01-10T17:41:00+0800"
            },
            {
               "parameter_number":2,
               "raw_value":0.001938,
               "timestamp":"2022-01-10T17:41:00+0800"
            }
         ]
         ...

...