body (and other?) fields cleared when updating a message to add a label using API v2
I am seeking to add a label to a message using API v2, but am finding that the body field on updated messages is getting cleared by the update. Can somebody help me better understand this behavior, and explain how to make an update like adding a label without changing other details on the message?
Here are details of what I've observed:
Based on the information here I have constructed a call like the following:
curl -X PUT \ https://[COMMUNITY DOMAIN]/api/2.0/messages/785 \ -H 'content-type: application/json' \ -H 'li-api-session-key: [SESSION KEY]' \ -d '{ "data":{ "type":"message", "labels":{
"items":[{"type":"label", "text":"my label"}]
} } }'
This successfully adds the label, but also clears the body field on the message. On the other hand, the subject field on the message is not changed. That makes me think an [undocumented] requirement is that when updating a message there are some fields which must be specified in the HTTP PUT request body with their current values in the HTTP request if they are to be left unmodified, while other fields will retain their current values even if they are not specified.
If anybody can confirm this, and give some hints as to which fields must be specified when updating a message through the API, that would help me greatly! I am worried about updating messages and corrupting/changing existing data without realizing it.
Have a look at this doc. It can be helpful