小编Mio*_*ter的帖子

使用Google Apps脚本和Pastebin.com API发布粘贴

我正在尝试使用电子表格脚本编辑器中的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);
}
Run Code Online (Sandbox Code Playgroud)

我运行此命令,日志显示为Bad API request, invalid api_option。我正在寻找解决方案,但没有找到任何解决方案。

说明文件:

Pastebin.com API

•Google Apps脚本的UrlFetchApp类

pastebin google-sheets google-apps-script google-apps-script-api

4
推荐指数
1
解决办法
295
查看次数