【问题标题】:Blogger API - How to add labels while inserting a new post?Blogger API - 如何在插入新帖子时添加标签?
【发布时间】:2016-08-18 09:26:34
【问题描述】:

我正在尝试使用 Blogger API v3.0 插入新的博客文章,下面是我的示例负载

var payload = {
  "title"   : "This is the post title2",
  "content" : "This is <b>HTML</b> post2"
};

这按预期工作,但我需要在发布这些新帖子时插入标签,我检查了文档和谷歌但没有帮助。我尝试了类似下面的方法

var payload = {
  "title"   : "This is the post title2",
  "content" : "This is <b>HTML</b> post2",
  "labels"  : "test_post,test,post"
};

基于一个v1.0的php例子,还是没有成功。

【问题讨论】:

  • 在构建新应用程序时,我鼓励您使用最新的 API 版本 v3。 v1 已弃用。
  • 嗨 @paolo 我正在使用 API V3.0,抱歉,如果我不清楚上面。
  • 其实是我的错。我忽略了你的第一行。我与最后一行有关。我的回答有帮助吗?

标签: api label blogger


【解决方案1】:

Post Resource documentation 声明labels 属性是一个列表。您的有效负载应该如下所示:

var payload = {
  "title"   : "This is the post title2",
  "content" : "This is <b>HTML</b> post2",
  "labels"  : [
                "test_post",
                "test",
                "post"
              ]
};

【讨论】:

  • 谢谢@paolo,等我回家再试试。
  • 工作正常 :) 谢谢@paolo
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-11-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多