Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blogger API中的URL和customMetaData选项_Api_Google Apps Script_Google Api_Blogger_Google Api Client - Fatal编程技术网

Blogger API中的URL和customMetaData选项

Blogger API中的URL和customMetaData选项,api,google-apps-script,google-api,blogger,google-api-client,Api,Google Apps Script,Google Api,Blogger,Google Api Client,我正在使用BloggerAPI创建帖子 在Blogger API的文档中: 在文章的资源表示中,我对两列感兴趣:url和customMetaData 我可以设置标题和内容,但URL和搜索描述不起作用 我想在customMetaData中发送搜索描述,但我不知道所需的JSON结构,因为文档中没有给出这样的内容 我的代码: var postUrl = "https://www.googleapis.com/blogger/v3/blogs/blogId/posts"; postUrl = p

我正在使用BloggerAPI创建帖子

在Blogger API的文档中:

在文章的资源表示中,我对两列感兴趣:url和customMetaData

我可以设置标题和内容,但URL和搜索描述不起作用

我想在customMetaData中发送搜索描述,但我不知道所需的JSON结构,因为文档中没有给出这样的内容

我的代码:

  var postUrl = "https://www.googleapis.com/blogger/v3/blogs/blogId/posts";
  postUrl = postUrl.replace("blogId",blogId);
  var options = {
    method:"post",
    contentType:"application/json",
    headers: { Authorization: "Bearer "+ ScriptApp.getOAuthToken()},
    muteHttpExceptions: true,
    payload: JSON.stringify({
      title: title,
      content: content,
      url: url,
      customMetaData: JSON.stringify({
        description: description
      })
    })
  }
  var res = UrlFetchApp.fetch(postUrl, options).getContentText();
  Logger.log(res)

你找到解决办法了吗?没有,什么都没找到。我认为目前不可能。你找到解决方案了吗?没有,什么都没有找到。我认为这目前是不可能的。
  var postUrl = "https://www.googleapis.com/blogger/v3/blogs/blogId/posts";
  postUrl = postUrl.replace("blogId",blogId);
  var options = {
    method:"post",
    contentType:"application/json",
    headers: { Authorization: "Bearer "+ ScriptApp.getOAuthToken()},
    muteHttpExceptions: true,
    payload: JSON.stringify({
      title: title,
      content: content,
      url: url,
      customMetaData: JSON.stringify({
        description: description
      })
    })
  }
  var res = UrlFetchApp.fetch(postUrl, options).getContentText();
  Logger.log(res)