Logo
Section 1 / 3

创建、更新和删除文章

了解博客文章的相关内容,以及如何创建、更新和删除它。

导入

创建、更新和删除文章

了解博客文章的相关内容,以及如何创建、更新和删除它。

参数类型描述
kindstring对象的类型。值为:"blogger#post"。注意:此值固定不变。
idstring文章的ID。
blogobject包含文章所属博客数据的对象。
blog.idstring文章所属博客的ID。
publisheddatetime文章的发布日期。格式:yyyy-mm-dd
updateddatetime文章最后一次更新的日期。格式:yyyy-mm-dd
urlstring文章的发布链接。
selfLinkstring文章的Blogger API URL。
titlestring文章标题。
contentstring文章内容。注意:此值可能包含HTML。
authorobject包含文章作者信息的对象。
author.idstring文章作者的ID。
author.displayNamestring文章作者的名称。
author.urlstring作者个人资料的发布链接。
author.imageobject包含作者头像信息的对象。
author.image.urlstring作者头像的URL。
repliesobject包含文章评论信息的对象。
replies.totalItemslong文章的评论总数。
replies.selfLinkstring文章评论的Blogger API URL。
labels[]list与文章关联的标签列表。
customMetaDatastring文章的元数据。
replies.items[]list文章评论列表。
locationobject包含文章地理位置信息的对象。注意:仅当文章被地理标记时才可用。
location.namestring文章所在位置的名称。
location.latdouble文章位置的纬度。
location.lngdouble文章位置的经度。
location.spanstring文章位置的视图范围。
titleLinkstring标题的URL。
images[]list文章的展示图片。
images[].urlstring文章展示图片的URL。
statusstring文章的状态。注意:此值仅对管理员级别请求有效。

参数类型类别描述
blogIdstring必需要添加文章的博客ID。
isDraftboolean可选设置为“True”表示以草稿形式创建文章,否则为“False”。
1blogId = '' 2 3data = { 4 'title': '', 5 'content': '' 6} 7 8url = 'https://blogger.googleapis.com/v3/blogs/' \ 9 + blogId + '/posts' 10 11response = requests.post(url, headers=headers, json=data) 12 13printResponse(response)

参数类型类别描述
blogIdstring必需要更新文章的博客ID。
postIdstring必需要更新的文章ID。
1blogId = '' 2postId = '' 3 4data = { 5 'title': '' 6} 7 8url = 'https://blogger.googleapis.com/v3/blogs/' \ 9 + blogId + '/posts/' + postId 10 11response = requests.put(url, headers=headers, json=data) 12 13printResponse(response)

参数类型类别描述
blogIdstring必需要删除文章的博客ID。
postIdstring必需要删除的文章ID。
1blogId = '' 2postId = '' 3 4url = 'https://blogger.googleapis.com/v3/blogs/' \ 5 + blogId + '/posts/' + postId 6 7response = requests.delete(url, headers=headers) 8 9printResponse(response)

页面

发布和撤销草稿帖子