Data Changed Event
Data changed events are triggered when any modifying operation is carried out on an entity. This is the most common event an integration to the THG Connect platform will be required to handle, this will allow workflows to be triggered on entities being created, updated or deleted.
Example
{ "eventType": "Data_Changed_Event", "eventTypeVersion": "0", "metadata": { "method": "create", "owner": "mycompany", "resourceUrl": "/mycompany/inventory/4f2929b5-2512-48da-be97-c362cc452dc8", "entityId": "4f2929b5-2512-48da-be97-c362cc452dc8", "parentEntityId": "", "entityType": "inventory", "entityTypeVersion": "0", "product": "thg-fulfil", "createdAt": "1724321803.378458", "consumer": "*", "provider": "mycompany", "reference": "thg:inventory:mycompany@4f2929b5-2512-48da-be97-c362cc452dc8" }, "data": { "sku": "948598f49", "title": "Demo Title", "defaultCountryOfOrigin": "GB", "harmonizedSystemCode": "23498395893", "hazmatCode": "00", "barcode": { "type": "ean", "barcode": "123456789" }, "dimensions": { "height": 1.2, "width": 1.3, "depth": 1.4, "mass": 1.5 }, "batchControlled": true }}
Breakdown
Metadata
KEY | DESCRIPTION |
---|---|
method | This is the operation carried out on the entity to trigger the data changed event, e.g. create, update, delete |
owner | The organisation who owns the data, this is the base of the URL when accessing the entity |
entityId | Unique ID of the entity |
parentEntityId | If the entity has a parent then it’ll be referenced here |
entityType | The entity type the data conforms to |
entityTypeVersion | Version of the entity type the data conforms to |
product | Product the entity is under, e.g. Inventory in an entity under THG Fulfil product |
createdAt | This is the created datetime of the entity (NOT created time of the event) |
consumer | List of consumer organisation (within your partnership) who can access the entity. * represents any |
provider | List of providers organisations (within your partnership) who can access the entity. * represents any |
reference | This is URI for the entity the data changed event is for, this can be used in ReferenceStr types to reference the entity |
Data
This is the payload of the entity after the operation was carried out. The payload will conform to the entity type and version defined in the metadata.