Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Edit an existing Pastebin document via API

Tags:

http

lua

pastebin

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

like image 287
Thomas Avatar asked Jun 03 '26 15:06

Thomas


1 Answers

There is no API for editing pastes directly.

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

like image 71
zed Avatar answered Jun 06 '26 05:06

zed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!