REST API output
- Last UpdatedAug 16, 2024
- 4 minute read
AVEVA Events to CONNECT requires the Message Data in a specific format to process it and publish it to CONNECT data services. It will poll the data from a REST API endpoint and the APIs in the REST API should return the data in a specific format similar to the sample provided below. Different endpoints can be configured in the agent using data selection. For more information, see Data selection.
Message Format
The agent accepts the JSON data in the format described below. It has message header and message body sections.
{
"messageHeaders": {
"MessageType": "Name of the type",
"Action": "CREATE/UPDATE/DELETE/PATCH",
"MessageFormat": "json",
"TypeId":"Id of any type",
"ContinuationToken": "To fetch next set of records"
},
"messageBody": [
{
"Id": "event11",
"Name": "event11",
"State": "Active",
"Properties": [
{
"PropertyTypeCode": "String",
"Id": "Id",
"Name": "Id",
"Flags": "None",
"State": "Active"
},
{
"PropertyTypeCode": "DateTime",
"Id": "ModifiedDateTime",
"Name": "ModifiedDateTime",
"Flags": "None",
"State": "Active"
}
]
}
]
}
Message header
The message header has information about the type data sent to CONNECT data services. It consists of multiple properties and each has its own significance.
|
Property name |
Data type |
Description |
|---|---|---|
|
MessageType |
string |
MessageType represents the name of the Type you would like to create. Supported Type Names: EventTypes, ReferenceDataTypes, Enumerations, Assets, AssetTypes, AuthorizationTags Data: Events, ReferenceData |
|
Action |
string |
Action represents the action you want to do for the Type. Supported Action Types: Create, Update, Delete,Patch. Note: The Action property supports the Patch action type for assets only. |
|
Format |
string |
Format represents the format of the data. Format currently only supports JSON. |
|
TypeId |
string |
TypeId represents the name of the Type that you are sending the data for. It can be a string value or array of strings that represents the type Ids for which data is present in the message body. See sample responses below. Note: TypeId is only required when the MessageType is Events or ReferenceData. |
|
ContinuationToken |
string |
ContinuationToken represents the token used to retrieve the next set of records. It is used for pagination. The agent will send the continuation token in the Header while making the GET call to the data source endpoint. |
Message body
The message body is an array and consists of actual data that you need to create in CONNECT data services. In the message body, you can pass multiple types you would like to create or series of events for an Event Type. For more information on event type and data, see Data selection.
Additional information
You can use queries in the agent configuration to poll the event type or event data for a particular time interval. For example, you can use query string filters for event start time and event end time. By using this, you can send only required event data to the CONNECT data services.
Sample response from data source REST API endpoints
EventsType
{
"messageHeaders": {
"messageType": "EventTypes",
"action": "Create",
"format": "JSON"
},
"messageBody": [
{
"id": "SampleEventType1304944",
"name": "SampleEventType1304944",
"state": "Active",
"properties": [
{
"propertyTypeCode": "String",
"id": "property1",
"name": "property1",
"flags": "None",
"state": "Active"
},
{
"propertyTypeCode": "Int32",
"id": "property2",
"name": "property2",
"flags": "Indexed",
"state": "Active",
"description": "property2"
},
{
"propertyTypeCode": "String",
"id": "updateby",
"name": "updateby",
"flags": "None",
"state": "Active"
}
]
}
]
}
Events (with a single type id)
{
"messageHeaders": {
"messageType": "Events",
"action": "Create",
"format": "JSON",
"typeId": "SampleEventType1304944",
"continuationToken": "MzowOlNhbXBsZUV2ZW50VHlwZTEzMDQ5NDQ="
},
"messageBody": [
{
"property1": "SampleEventType1304944_1118939237",
"property2": 87,
"updateby": "Sample 1304944_208336875",
"id": "SampleEventType1304944_553198331",
"eventStartTime": "2023-08-21T03:50:19Z"
},
{
"property1": "SampleEventType1304944_831789585",
"property2": 151,
"updateby": "Sample 1304944_187166036",
"id": "SampleEventType1304944_203123769",
"eventStartTime": "2023-08-21T03:50:20Z"
},
{
"property1": "SampleEventType1304944_2019964341",
"property2": 158,
"updateby": "Sample 1304944_1467261484",
"id": "SampleEventType1304944_1186798838",
"eventStartTime": "2023-08-21T03:50:21Z"
},
{
"property1": "SampleEventType1304944_1666566290",
"property2": 9,
"updateby": "Sample 1304944_905937900",
"id": "SampleEventType1304944_2125902368",
"eventStartTime": "2023-08-21T03:50:22Z"
},
{
"property1": "SampleEventType1304944_1158783639",
"property2": 44,
"updateby": "Sample 1304944_560815081",
"id": "SampleEventType1304944_1466280607",
"eventStartTime": "2023-08-21T03:50:23Z"
}
]
}
Events (with multiple type Ids and values)
{
"messageHeaders": {
"messageType": "Events",
"action": "Create",
"format": "JSON",
"typeId": [
{
"typeId": "EventTypes1"
},
{
"typeId": "EventTypes2"
}
]
},
"messageBody": [
{
"EventTypes1": [
{
"id": "EventTypes1_1866175867",
"createdTime": "2024-02-06T01:00:00Z",
"reference": {
"id": "ReferenceDataTypes1_192275741"
},
"EventState": "OPEN",
"asset": {
"id": "AssetId1"
},
"createdByUser": "EventTypes1_695344712",
"updateby": "EventTypes1_805048717",
"startTime": "2024-02-06T01:00:00Z"
},
{
"id": "EventTypes1_1080854421",
"createdTime": "2024-02-06T01:10:00Z",
"reference": {
"id": "ReferenceDataTypes1_882105345"
},
"EventState": "IDLE",
"asset": {
"id": "AssetId1"
},
"createdByUser": "EventTypes1_1485048878",
"updateby": "EventTypes1_1930073400",
"startTime": "2024-02-06T01:10:00Z"
}
]
},
{
"EventTypes2": [
{
"id": "EventTypes2_730944773",
"updateby": "EventTypes2_528908458",
"startTime": "2024-02-10T01:00:00Z"
},
{
"id": "EventTypes2_2107069012",
"updateby": "EventTypes2_67843917",
"startTime": "2024-02-10T01:10:00Z"
}
]
}
]
}
Asset (Patch action)
{
"messageHeaders": {
"messageType": "Assets",
"action": "Patch",
"format": "JSON"
},
"messageBody": [
{
"Filler1 Id": [
{
"op": "add",
"path": "/assetTypeId",
"value": "FillerType"
},
{
"op": "add",
"path": "/name",
"value": "Filler1"
},
{
"op": "add",
"path": "/description",
"value": "Patch Asset Filler1"
},
{
"op": "add",
"path": "/metaData/0b59a77f-4822-4352-a135-ee540c52158b",
"value": {
"id": "0b59a77f-4822-4352-a135-ee540c52158b",
"name": "MaxFillRate",
"sdsTypeCode": "Int64",
"value": 8,
"uom": "US gallon per minute"
}
},
{
"op": "add",
"path": "/metaData/296d92e2-18d2-4622-b5f9-9c854cb2afa2",
"value": {
"id": "296d92e2-18d2-4622-b5f9-9c854cb2afa2",
"name": "Site",
"sdsTypeCode": "String",
"value": "Houston",
"uom": null
}
},
{
"op": "add",
"path": "/metaData/ca97dafe-48f5-48ae-9c95-0d6e31abae51",
"value": {
"id": "ca97dafe-48f5-48ae-9c95-0d6e31abae51",
"name": "Line",
"sdsTypeCode": "String",
"value": "LineA",
"uom": null
}
}
]
},
{
"Palletizer1 Id": [
{
"op": "add",
"path": "/assetTypeId",
"value": "PalletizerType"
},
{
"op": "add",
"path": "/name",
"value": "Palletizer1"
},
{
"op": "add",
"path": "/description",
"value": "Patch Asset Palletizer11"
},
{
"op": "add",
"path": "/metaData/82d2225b-5ad6-482d-8876-b36970c9389e",
"value": {
"id": "82d2225b-5ad6-482d-8876-b36970c9389e",
"name": "Site",
"sdsTypeCode": "String",
"value": "Houston",
"uom": null
}
},
{
"op": "add",
"path": "/metaData/9ca16b96-aca8-468f-a114-491f4fd7b67e",
"value": {
"id": "9ca16b96-aca8-468f-a114-491f4fd7b67e",
"name": "Line",
"sdsTypeCode": "String",
"value": "LineA",
"uom": null
}
}
]
}
]
}