Updating Engagement Metadata Issue


#1

I created a task in the UI and looked at the data via the API:

GET https://api.hubapi.com/engagements/v1/engagements/

The metadata looks like this:

"metadata": {
    "body": "<p>Task body from UI</p>",
    "status": "NOT_STARTED",
    "subject": "Task Created in UI",
    "taskType": "TODO",
    "reminders": [
        1509537600000
    ],
    "sendDefaultReminder": true
}

Then, I use the API to modify the body like this:
PUT https://api.hubapi.com/engagements/v1/engagements/
body:

{
“metadata”: {
“body”: “Body modified from API”
}
}

Now when I do a GET to view the task I see the rest of the metadata got wiped out:

"metadata": {
    "body": "Body modified from API",
    "reminders": []
}

Do I have to repopulate every metadata property before I PUT it back up? I would have expected it to not touch any properties that I did not specify.


#2

Hi @homerlex,

Based on the testing I’ve done so far, this doesn’t appear to be working as designed. I’ll touch base with the product team for some more information, and reach back out here once I have it.


#3

Any more info on this one yet?


#4

Hi @homerlex,

Not yet, still digging into this with the team. I’ll reach back out once I have an update on this.


#5

Hi @homerlex,

This behavior is actually working as designed. PUT requests to https://api.hubapi.com/engagements/v1/engagements/:engagementId are intended to replace the metadata of the engagement, rather than merge new & existing data. There is another endpoint that will merge new & existing engagement data that I’m working to make public. I’ll post here again once that becomes available.


#6

Hi @homerlex,

Docs have been updated. Making PATCH requests to the Update an Engagement endpoint (instead of PUT requests) will merge the existing and new metadata: https://developers.hubspot.com/docs/methods/engagements/update_engagement-patch