当我查看"更新视图"端点的文档时,可用的信息非常少(请参阅https://developers.podio.com/doc/views/update-view-20069949).当前文档声明端点接受一个参数view_id,但似乎API使用者也希望能够提供其他详细信息来修改视图的定义.
是否有任何示例代码可用于演示如何使用此端点?
Podio Ruby客户端提供使用此端点的代码.如果你看一下这里你可以看到端点需要在PUT中提供一个JSON主体来指定新视图的定义.在Ruby代码中,它被称为"属性",这与其他View操作的API文档一致.这是一个示例HTTP请求:
PUT /view/31011898 HTTP/1.1
Host: api.podio.com
Authorization: OAuth2 your_oauth2_token_here
Content-Type: application/json
Cache-Control: no-cache
{
"layout": "table",
"name": "SPAM",
"rights": [
"delete",
"view",
"update"
],
"fields": {},
"sort_desc": false,
"created_by": {
"user_id": <creator user id>,
"space_id": null,
"image": {
"hosted_by": "podio",
"hosted_by_humanized_name": "Podio",
"thumbnail_link": "https://d2cmuesa4snpwn.cloudfront.net/public/",
"link": "https://d2cmuesa4snpwn.cloudfront.net/public/",
"file_id": <some file id>,
"external_file_id": null,
"link_target": "_blank"
},
"profile_id": <profile id>,
"org_id": null,
"link": "https://podio.com/users/<user id>",
"avatar": <avatar id>,
"type": "user",
"last_seen_on": "2016-10-27 19:58:22",
"name": "Podio TESTER"
},
"sort_by": "created_on",
"items": 0,
"created_on": "2016-10-27 19:58:26",
"private": true,
"filters": [],
"filter_id": 31011898,
"groupings": {},
"type": "private",
"view_id": 31011898,
"grouping": {}
}
Run Code Online (Sandbox Code Playgroud)