通过API编辑现有的Pastebin文档 [英] Edit an existing Pastebin document via API
问题描述
我正在尝试在LUA中编写一个函数来编辑我的pastebin代码.
I am trying to write a function in LUA to edit my pastebin code.
我可以使用以下代码撰写HTTP帖子:
I can use this code to make a HTTP post:
http.post(字符串url,字符串postData [,表标题])
http.post(string url, string postData [, table headers])
我也可以将此代码用于HTTP get:
I can also use this code for a HTTP get:
http.get(字符串url [,表标题])
http.get(string url [, table headers])
在Pastebin网站上的
https://pastebin.com/api 有关使用API的信息. 我不确定该网站是否可以帮助我解决问题.
on the Pastebin website https://pastebin.com/api are information about using the API. I am not sure, if this website can help me to solve my problem.
有人知道如何填写标题表吗?
Does someone know how to fill the headers table?
这是我尝试过的程序:
headers = {}
headers["api_dev_key"]= 'myDevKey...'; // your api_developer_key
headers["api_paste_code"] = 'my edited text'; // your paste text
headers["api_paste_private"] = '0'; // 0=public 1=unlisted 2=private
headers["api_paste_name"] = 'justmyfilename.php'; // name or title of your paste
headers["api_paste_expire_date"] = '10M';
headers["api_paste_format"] = 'php';
headers["api_user_key"] = ''; // if an invalid or expired api_user_key is used, an error will spawn. If no api_user_key is used, a guest paste will be created
headers["api_paste_name"] = myPastebinName;
headers["api_paste_code"] = myPastebinPassword;
http.get("https://pastebin.com/edit/dQMDfbkM", headers)
不幸的是,这不起作用,并且pastebin API帮助站点上没有用于编辑粘贴的示例.只是为了创建一个新的.
unfortunately this is not working and on the pastebin API help site is no exsample for editing a paste. just for creating a new one.
对于我来说,也不清楚我是否必须使用post或get
for me it is also not clear if I have to use post or get
推荐答案
没有用于直接编辑粘贴的API.
There is no API for editing pastes directly.
您只能删除旧粘贴,并使用更新后的文本创建新粘贴.
You can only delete old paste and create new with updated text.
这篇关于通过API编辑现有的Pastebin文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!