问题
I am creating posts using Blogger API.
In documentation of Blogger API: https://developers.google.com/blogger/docs/3.0/reference/posts
In resource representation of Posts, I am interested in 2 columns: url and customMetaData
Property name Value Description
url string The URL where this post is displayed.
customMetaData string The JSON metadata for the post.
I am able to set title and content, but URL and Search Description are not working.
I want to send Search Description in customMetaData, but I don't know the structure of JSON required as nothing such is given in documentation.
My Code:
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)
来源:https://stackoverflow.com/questions/59503028/url-and-custommetadata-option-in-blogger-api