Forum Discussion

jpemeric's avatar
jpemeric
New Contributor
3 months ago

Connect Server PATCH /title is deleting fields from Item

Running into a weird one with a connect api / server spun up in AWS. When I attempt to update the title of a vault item, any "extra" fields, sections, or files are dropped. Here's a psuedocode example.

Item
{
"category": "DOCUMENT",
"fields": [{
"id": "notesPlain",
...
}],
"files": [{
  "content_path": "/v1/vaults/111/items/222/files/333/content",
  "id": "333",
  "name": "filename.pdf",
  "size": 369343
}, {
  "content_path": "/v1/vaults/111/items/222/files/444/content",
  "id": "444",
  "name": "filename.jpeg",
  "section": { "id": "add more" }
}],
"id": "222",
"sections": [{ "id": "add more" }],
"title": "Test Item"
"vault": {
"id": "111",
  "name": "Test Vault"
}
}

Request
PATCH {domain}/v1/vaults/111/items/222 -d
[{
"op": "replace",
"path": "/title",
"value": "Test Item v2"
}]

Resulting Item
{
"category": "DOCUMENT",
"fields": [{
"id": "notesPlain",
...
}],
"files": [{
"content_path": "/v1/vaults/111/items/222/files/333/content",
"id": "333",
"name": "filename.pdf",
"size": 369343
}],
"id": "222",
"title": "Test Item v2"
"vault": {
"id": "111",
"name": "Test Vault"
}
}

Both the second file and section are removed. From the /activity endpoint it appears that a single "UPDATE" was done on the item, so I don't think it's the connect server "duplicating" or sending secondary destructive requests or anything. I've also tried PUT and sent the entire original payload, only modifying the title, but this also removes the fields. Is there a way that we can programmatically update the title without dropping data out of the item?

No RepliesBe the first to reply