【发布时间】:2018-10-22 16:48:15
【问题描述】:
我正在尝试使用电子表格脚本编辑器中的 Google Apps 脚本 制作 Pastebin.com 粘贴。谁能告诉我我做错了什么?
function postPastebinPost() {
var options, url, apiKey, payload, response;
apiKey = <api key goes here>;
payload = 'Hello World';
options = {
'method' : 'post',
'payload' : payload
};
url = 'https://pastebin.com/api/api_post.php'
+ '?api_dev_key=' + apiKey
+ '&api_option=paste'
+ '&api_paste_code=' + encodeURIComponent(payload);
response = UrlFetchApp.fetch(url, options);
Logger.log(response);
}
我运行它,我的日志显示为Bad API request, invalid api_option。我已经搜索了解决方案,但我没有找到任何解决方案。
文档:
• Google Apps 脚本的UrlFetchApp Class
【问题讨论】:
标签: google-apps-script google-sheets pastebin google-apps-script-api