Description
...
- Step 2 - Initialization
- The following steps need to be executed after the initial configuration, any time the configuration changes or whenever the Export Distribution service restarts.
- Verify if the tags are already existing in the PI Archive.
- For each configured tag, the following query must be executed.
- GET https://mypiwebapiendpoint/piwebapi/search/query?q=name:tagname&scope=pi:mypiarchive
If the tag already exists, the reply will look like:
{ "TotalHits": 1, "Links": { "Next": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3Atagname&scope=pi%3Amypiarchive&count=10&start=10", "First": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3Atagname&scope=pi%3Amypiarchive&count=10", "Last": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3Atagname&scope=pi%3Amypiarchive&count=10&start=0" }, "Errors": [], "Items": [ { "Name": "tagname", "Description": "Some Description", "MatchedFields": [ { "Field": "name" } ], "ItemType": "pipoint", "AFCategories": [], "UniqueID": "\\\\{044de274-8d72-4cb6-839b-9e415e793dd8}\\?3", "WebId": "P0dOJNBHKNtkyDm55BXnk92AAwAAAAU1JWR0RZUExNT1NJRDAzXENEVDE1OA", "UoM": "deg. c", "DataType": "float32", "Links": { "Self": "https://mypiwebapiendpoint:443/piwebapi/points/P0dOJNBHKNtkyDm55BXnk92AAwAAAAU1JWR0RZUExNT1NJRDAzXENEVDE1OA"
}, "Score": 13.62607 } ] }
In this case the WebId of the tag must be read and stored in EdgeX in order to be used in further iterations. If the tag does not exist, the reply will look something like:{ "Links": { "Next": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3ACDT15&scope=pi%3Asrvgdyplmosid03pi%3Amypiarchive&count=10&start=10", "First": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3ACDT15&scope=pi%3Asrvgdyplmosid03pi%3Amypiarchive&count=10", "Last": "https://mypiwebapiendpoint/piwebapi/search/query?q=name%3ACDT15&scope=pi%3Asrvgdyplmosid03pi%3Amypiarchive&count=10&start=0" }, "Errors": [], "Items": [] }
In this case the tag will have to be created with the following command
POST https://mypiwebapiendpoint/piwebapi/dataservers/{webId}/points where WebId is riferred to the target dataserver. The payload of the POST request should look like the following:
{ "Name": "PointNamedeployment001.deviceABC.measurement005", "Descriptor": "Some description as per EdgeX Metadata", "PointClass": "classic", "PointType": "Float32", "DigitalSetName": "", "EngineeringUnits": "", "Step": false, "Future": false }
- Verify if the tags are already existing in the PI Archive.
- The following steps need to be executed after the initial configuration, any time the configuration changes or whenever the Export Distribution service restarts.
- Step 3 - Data Export
- At each Export Interval as per defined in the configuration, a new POST call should be fired as below:
POST https://mypiwebapiendpoint/piwebapi/streamsets/recorded with the following JSON payload containing a section for each WebId corresponding to the tags
[
{"WebId":"P0dOJNBHKNtkyDm55BXnk92AAwAAAAU1JWR0RZUExNT1NJRDAzXENEVDE1OA",
"Items":[
{"Timestamp":"2018-01-16T20:31:50.267Z","Value":15308.23},
{"Timestamp":"2018-01-16T20:31:51.234Z","Value":15308.88},
{"Timestamp":"2018-01-16T20:31:51.357Z","Value":15308.04},
{"Timestamp":"2018-01-16T20:31:51.678Z","Value":15309.15},
{"Timestamp":"2018-01-16T20:31:51.907Z","Value":15309.65}
]
},
{"WebId":"P0dOJNBHKNtkyDm55BXnk92A3OM1AAU1JWR0RZUExNT1NJRDAzXEZPR0hPUk4uQ1JJTw",
"Items":[
{"Timestamp":"2018-01-16T20:31:50.653Z","Value":15308.67},
{"Timestamp":"2018-01-16T20:31:51.124Z","Value":15308.86},
]
},
]
- A successful request will provide a "202 Accepted" response
- The activities (request/reply) should be logged through EdgeX log service
- At each Export Interval as per defined in the configuration, a new POST call should be fired as below:
Possible improvements for the next version (Delhi Release):
...
- Possibility to perform data backfill (From StartTimestamp to EndTimestamp) - this may require an architectural change in Export Services
- Manage conflicts with overlapping tag names between different EdgeX deployments
- Support Kerberos authentication (Will need to specify in the configuration Keytab, Kdc, Principal and Realm)
Possible improvements for the long term:
...
To be updated.
Current status
Waiting for Go Export Client & Distribution to support HTTPS REST
[
{"WebId":"P0dOJNBHKNtkyDm55BXnk92A3OM1AAU1JWR0RZUExNT1NJRDAzXEZPR0hPUk4uQ1JJTw",
"Items":[
{"Timestamp":"2018-01-16T20:31:50Z","Value":15308},
{"Timestamp":"2018-01-16T20:31:51Z","Value":15308},
{"Timestamp":"2018-01-16T20:31:51Z","Value":15308},
{"Timestamp":"2018-01-16T20:31:51Z","Value":15309},
{"Timestamp":"2018-01-16T20:31:51Z","Value":15309}
]
}
...
which is mandatory for this export services to work