通过 API 编辑现有的 Pastebin 文档

我正在尝试编写一个在 LUA 中编辑我的 Pastebin 代码的函数。

我可以使用这段代码进行 HTTP post:

http.post(string url, string postData [, table headers])

我也可以使用这段代码进行 HTTP get:

http.get(string url [, table headers])

在 Pastebin 网站 https://pastebin.com/api 上有关于使用 API 的信息。 我不确定这个网站是否能帮助我解决我的问题。

有人知道如何填写 headers 表格吗?

这是我尝试的程序:

headers = {}
headers["api_dev_key"] = 'myDevKey...'; // 您的 api_developer_key
headers["api_paste_code"]   = 'my edited text'; // 您的粘贴文本
headers["api_paste_private"] = '0'; // 0=公共 1=未列出 2=私人
headers["api_paste_name"] = 'justmyfilename.php'; // 您的粘贴名称或标题
headers["api_paste_expire_date"] = '10M';
headers["api_paste_format"] = 'php';
headers["api_user_key"] = ''; // 如果使用无效或过期的 api_user_key,将出现错误。如果不使用 api_user_key,则将创建一个访客粘贴
headers["api_paste_name"] = myPastebinName;
headers["api_paste_code"] = myPastebinPassword;
http.get("https://pastebin.com/edit/dQMDfbkM", headers)

不幸的是,这并没有起作用,在 pastebin API 帮助网站上没有编辑粘贴的示例,只有创建新粘贴的示例。

对我来说也不清楚我是否需要使用 post 或 get。

点赞
用户6219657
用户6219657

将下面翻译成中文并且保留原本的 markdown 格式

There is no API for editing pastes directly.

You can only delete old paste and create new with updated text.

翻译

没有直接编辑粘贴的API。

你只能删除旧的粘贴并创建一个新的粘贴,其中包含更新后的文本。
2018-01-19 06:28:43