从Google云端硬盘文件元数据中的属性列表中修补/更新特定键值

问题描述 投票:0回答:1

所以我的驱动器中有这些属性。现在我想从列表中更新特定的键值对,但似乎google drive api patch需要添加另一组属性。

https://developers.google.com/drive/api/v2/reference/files/patch

"properties":[{"visibility":"PUBLIC","kind":"drive#property","etag":"\"LIfz66WQFJW5vkUY9zfkRsF1GXw/v2QgQs4jWTpXupDwCreIaEqwUB0\"","value":"content_article","key":"TAG_SYSTEM_NAME"},{"visibility":"PUBLIC","kind":"drive#property","etag":"\"LIfz66WQFJW5vkUY9zfkRsF1GXw/_gkHHQjcY8SsrxQ5YfkEKLgJd78\"","value":"content","key":"TAGSET_SYSTEM_NAME"},{"visibility":"PUBLIC","kind":"drive#property","etag":"\"LIfz66WQFJW5vkUY9zfkRsF1GXw/zlFg7XikUX87CoN8nlKkxomLGZA\"","value":"1204622","key":"ID"},{"visibility":"PUBLIC","kind":"drive#property","etag":"\"LIfz66WQFJW5vkUY9zfkRsF1GXw/UP9PtLc4WE_Q7ADNu0V-OSG22QQ\"","value":"1037753","key":"BRIDGE_KM_CON_TAG_GROUP_ID"},{"visibility":"PUBLIC","kind":"drive#property","etag":"\"LIfz66WQFJW5vkUY9zfkRsF1GXw/sznUVWiSHbLf7-HDsqvfCqoFEpg\"","value":"Content Categories","key":"TAGSET_DISPLAY_NAME"},{"visibility":"PUBLIC","kind":"drive#property","etag":"\"LIfz66WQFJW5vkUY9zfkRsF1GXw/6F3Yo9Sj6aeMw5BlH7kKSfXcH9A\"","value":"Y","key":"is_featured"},{"visibility":"PUBLIC","kind":"drive#property","etag":"\"LIfz66WQFJW5vkUY9zfkRsF1GXw/VStyd4kXuLSIRpFXYvRPMBuYdDU\"","value":"Article","key":"TAG_DISPLAY_NAME"},{"visibility":"PUBLIC","kind":"drive#property","etag":"\"LIfz66WQFJW5vkUY9zfkRsF1GXw/PglkjP6d-2vMgJrovo3b02atA3g\"","value":"KM1100996","key":"kmid"}]
google-drive-sdk
1个回答
0
投票

除非你有充分的理由使用v2 API(它们确实存在),否则你应该使用https://developers.google.com/drive/api/v3/reference/files/update

至少对于v3,您在PATCH正文中提供的任何属性都将与现有属性合并。

所以...

开始文件:{foo:1}

补丁:{bar:2}

叶子文件:{foo:1,bar:2}

要删除属性,请使用null修补它

开始文件:{foo:1,bar:2}

然后补丁:{bar:null}

叶子文件:{foo:1}

© www.soinside.com 2019 - 2024. All rights reserved.