POST dms.request.update.metadata

As of Version2019 Winter
HTTP MethodPOST
Response FormatJSON
Description

An update of metadata can trigger the webhook before the JSON update description is normalized and validated, and before the actual update.

Add currentVersion and preserve_missing_properties to the options in the body of the original update request, which is a one-element list of objects. The current version of the only object in this list is the currentVersion. The preserve_missing_properties parameter is a boolean that allows for differentiation between  PATCH (true) and POST (false) update.

The predicate is applied to the only object in the one-element list.

Requirements for External EndpointThe target URL must be a POST endpoint accepting and returning a list of objects including the metadata.
Affected API Requests

POST /api/dms/objects/{objectId}

PATCH /api/dms/objects/{objectId}

Restart ServiceAPI-gateway service
HeaderAuthorization-Header
Example Request Body
{
    "objects": [{
        "properties": {
            "Subject": {
                "value": "new subject"
            }
        },
        "options": {
            "preserve_missing_properties": true,
            "currentVersion": {
                "properties": {
                    "system:objectId": {
                        "value": "5d460d53-b471-4c07-a5a6-d9ad95bddfe4"
                    },
                    "system:baseTypeId": {
                        "value": "system:document"
                    },
                    "system:objectTypeId": {
                        "value": "appEmail:email"
                    },
                    "system:createdBy": {
                        "value": "111c226c-3a44-5e66-7777-8d999a0000e1"
                    },
                    "system:creationDate": {
                        "value": "2020-03-06T16:46:13.310Z"
                    },
                    "system:lastModifiedBy": {
                        "value": "111c226c-3a44-5e66-7777-8d999a0000e5"
                    },
                    "system:lastModificationDate": {
                        "value": "2020-08-21T14:04:04.390Z"
                    },
                    "system:versionNumber": {
                        "value": 5
                    },
                    "system:tenant": {
                        "value": "default"
                    },
                    "system:traceId": {
                        "value": "123456787654321"
                    },
                    "appEmail:from": {
                        "value": "user1@example.de>"
                    },
                    "appEmail:to": {
                        "value": ["user2@example.de>",
                        "user3@example.de>"]
                    },
                    "appEmail:subject": {
                        "value": "old subject"
                    },
                    "appEmail:received": {
                        "value": "2019-12-22T11:52:19.000Z"
                    }
                },
                "contentStreams": [{
                    "contentStreamId": "0AB98765-CDEF-4321-ABCD-098EF76AB543",
                    "length": 1093,
                    "mimeType": "message/rfc822",
                    "fileName": "content.eml",
                    "digest": "1234567812345678123456781234567812345678123456781234567812345678",
                    "repositoryId": "repo242"
                }]
            }
        }
    }]
}
Example Predicate

1) Check if the object type is appEmail:email:
spel:'appEmail:email'.equals(options['currentVersion']['properties']['system:objectTypeId']['value'])

2) Check if the appEmail:subject will be changed during the update.  Since the webhook is triggered before the normalization is done, the second part is required in order to catch both input formats that are accepted in the API.
spel:properties['appEmail:subject']!=null || properties['subject']!=null