Edit an existing Pastebin document via API

浪子不回头ぞ 提交于 2019-12-24 14:27:24

问题


I am trying to write a function in LUA to edit my pastebin code.

I can use this code to make a HTTP post:

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

I can also use this code for a HTTP get:

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

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?

this is the program i tried:

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)

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.

for me it is also not clear if I have to use post or get


回答1:


There is no API for editing pastes directly.

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



来源:https://stackoverflow.com/questions/48332389/edit-an-existing-pastebin-document-via-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!