# Example messages

For Right, Table, Amount, and File char types, an additional message property will be included in the messages to ensure the proper context within Rightsline is provided, called `rootEntity`.

### Catalog Item Created

```javascript
{
    "action": "created",
    "messageGroupId": 1,
    "entity": {
        "entityId": 3830,
        "charTypeId": 1,
        "template": {
            "templateId": 1,
            "templateName": "Feature"
        },
        "status": {
            "statusId": 0,
            "statusName": null
        }
    },
    "createdById": 12345,
    "createdDate": "2019-02-21T19:58:46.777Z",
    "lastUpdatedById": 12345,
    "lastUpdatedDate": "2019-02-21T19:58:46.777Z",
    "statusUpdatedById": 12345,
    "statusUpdatedDate": "2019-02-21T19:58:46.777Z"
}
```

### Catalog Item Updated

```javascript
{
    "action": "updated",
    "messageGroupId": 1,
    "entity": {
        "entityId": 3830,
        "charTypeId": 1,
        "template": {
            "templateId": 1,
            "templateName": "Feature"
        },
        "status": {
            "statusId": 1,
            "statusName": "Development"
        }
    },
    "createdById": 12345,
    "createdDate": "2019-02-21T19:58:46.777Z",
    "lastUpdatedById": 12345,
    "lastUpdatedDate": "2019-02-21T19:58:48.373Z",
    "statusUpdatedById": 12345,
    "statusUpdatedDate": "2019-02-21T19:58:46.777Z"
}
```

### Catalog Item Deleted

```javascript
{
    "action": "deleted",
    "messageGroupId": 1,
    "entity": {
        "entityId": 3830,
        "charTypeId": 1,
        "template": {
            "templateId": 1,
            "templateName": "Feature"
        },
        "status": {
            "statusId": 1,
            "statusName": "Development"
        }
    },
    "createdById": 12345,
    "createdDate": "2019-02-21T19:58:46.777Z",
    "deletedById": 12345,
    "deletedDate": "2019-02-21T20:21:48.2105751Z",
    "statusUpdatedById": 12345,
    "statusUpdatedDate": "2019-02-21T19:58:46.777Z"
}
```

### Right Created

```javascript
{
    "action": "created",
    "messageGroupId": 3,
    "entity": {
        "entityId": 2978,
        "charTypeId": 3,
        "template": {
            "templateId": 1,
            "templateName": "Rights In"
        },
        "status": {
            "statusId": 0,
            "statusName": null
        }
    },
    "createdById": 12345,
    "createdDate": "2019-02-21T20:00:39.18Z",
    "lastUpdatedById": 12345,
    "lastUpdatedDate": "2019-02-21T20:00:39.18Z",
    "statusUpdatedById": 12345,
    "statusUpdatedDate": "2019-02-21T19:58:46.777Z"
}
```

### Right Updated

```javascript
{
    "rootEntity": {
        "entityId": 3830,
        "charTypeId": 1
    },
    "action": "updated",
    "messageGroupId": 3,
    "entity": {
        "entityId": 2978,
        "charTypeId": 3,
        "template": {
            "templateId": 1,
            "templateName": "Rights In"
        },
        "status": {
            "statusId": 1,
            "statusName": "Active"
        }
    },
    "createdById": 12345,
    "createdDate": "2019-02-21T19:58:46.777Z",
    "lastUpdatedById": 12345,
    "lastUpdatedDate": "2019-02-21T20:00:44.72Z",
    "statusUpdatedById": 12345,
    "statusUpdatedDate": "2019-02-21T19:58:46.777Z"
}
```

### Right Deleted

```javascript
{
    "rootEntity": {
        "entityId": 3830,
        "charTypeId": 1
    },
    "action": "deleted",
    "messageGroupId": 3,
    "entity": {
        "entityId": 2978,
        "charTypeId": 3,
        "template": {
            "templateId": 1,
            "templateName": "Rights In"
        },
        "status": {
            "statusId": 1,
            "statusName": "Active"
        }
    },
    "createdById": 12345,
    "createdDate": "2019-02-21T20:01:50.8377191Z",
    "deletedById": 12345,
    "deletedDate": "2019-02-21T20:01:50.8377191Z",
    "statusUpdatedById": 12345,
    "statusUpdatedDate": "2019-02-21T19:58:46.777Z"
}
```

### Relationship Created

```javascript
{
    "action": "created",
    "messageGroupId": 0,
    "entityId": 214562,
    "parentEntity": {
        "entityId": 3830,
        "charTypeId": 1,
        "template": {
            "templateId": 1,
            "templateName": "Feature"
        },
        "status": {
            "statusId": 1,
            "statusName": "Development"
        }
    },
    "childEntity": {
        "entityId": 2978,
        "charTypeId": 3,
        "template": {
            "templateId": 1,
            "templateName": "Rights In"
        },
        "status": {
            "statusId": 1,
            "statusName": "Active"
        }
    },
    "relationshipType": {
        "relationshipTypeId": 0,
        "relationshipTypeName": "Default"
    },
    "createdById": 12345,
    "createdDate": "2019-02-21T19:58:46.777Z"
}
```

### Action Executed

This message is to track the event of a Workflow Action being taken; with or without a status change. The `action` of the message will be `action-executed`, and the message will contain new fields to hold the data on what action was taken, who took the action, and when.

```javascript
{
    "action": "action-executed",
    "messageGroupId": 4,
    "entity": {
        "entityId": 609,
        "charTypeId": 4,
        "template": {
            "templateId": 2,
            "templateName": "Distribution Deal"
        },
        "status": {
            "statusId": 24,
            "statusName": "Approval Requested"
        }
    },
    "createdById": 12345,
    "createdDate": "2019-04-24T19:01:41.653Z",
    "lastUpdatedById": 12345,
    "lastUpdatedDate": "2019-04-25T18:03:56.147Z",,
    "statusUpdatedById": 12345,
    "statusUpdatedDate": "2019-02-21T19:58:46.777Z"
    "actionExecutedById": 12345,
    "actionExecutedDate": "2019-04-30T17:54:29.5152074Z" ,
    "executedActionId": 27
}
```

### Availability Changed

This message will have the same `messageGroupId` as the Right char type, and the `action` will be `availability-changed`.

The dimension keys will show the current state of the dimensions at the time of the message.

```javascript
{
    "id": "42411544-61e8-41c6-affd-cc1da8d0d6f7",
    "rootEntities": [
        {
            "entityId": 3,
            "charTypeId": 1
        },
        {
            "entityId": 1048,
            "charTypeId": 1
        },
        {
            "entityId": 23,
            "charTypeId": 4
        }
    ],
    "action": "availability-changed",
    "messageGroupId": 3,
    "entity": {
        "entityId": 37,
        "charTypeId": 3,
        "template": {
            "templateId": 1,
            "templateName": "Rights In"
        },
        "status": {
            "statusId": 1,
                "statusName": "Active"
        },
    },
    "windowStart": "2016-04-01T00:00:00Z",
    "windowEnd": "2025-04-30T00:00:00Z",
    "isExclusive": true,
    "activeIndicatorChanged": false,
    "dim1": [
        {
            "id": 2,
            "xref": null,
            "value": "All Media"
        }
    ],
    "dim1Added": [],
    "dim1Removed": [],
    "dim2": [
        {
            "id": 1,
            "xref": null,
            "value": "Worldwide"
        }
    ],
    "dim2Added": [],
    "dim2Removed": [],
    "dim3": [
        {
            "id": 4,
            "xref": null,
            "value": "All Languages"
        }
    ],
    "dim3Added": [],
    "dim3Removed": [],
    "dim4": [],
    "dim4Added": [],
    "dim4Removed": [],
    "createdById": 12345,
    "createdDate": "2016-04-22T03:30:23.12Z"
}
```
