I am unable to get the script below to work. I am trying to paste code using the PasteBin API.
After acquiring a valid APIUSERKEY, pasteFile() is executed but I get "Bad API request, invalid api_option" onload. I am not sure what I am doing wrong.
API_PASTE_NAME = encodeURI("API Testing"),
API_PASTE_CODE = encodeURI("Some really good code");
var params = "api_dev_key=" + API_DEV_KEY + "&api_user_name=" + API_USER_NAME + "&api_user_password=" + API_USER_PASSWORD;
GM_xmlhttpRequest({
method: "POST",
url: "http://pastebin.com/api/api_login.php",
data: params,
headers: { "Content-Type": "application/x-www-form-urlencoded", Referer: "http://pastebin.com" },
onload: function (response)
{
if (response.status == 200)
{
API_USER_KEY = response.responseText; //We need the user key to make a private post
pasteFile();
}
}
});
function pasteFile()
{
var params2 = "api_dev_key=" + API_DEV_KEY + "&api_user_name=" + API_USER_NAME + "&api_user_password=" + API_USER_PASSWORD
+ "&api_user_key=" + API_USER_KEY + "&api_paste_expire_date=10M&api_paste_private=1&api_paste_format=js&api_paste_name=" + API_PASTE_NAME + "&api_paste_code=" + API_PASTE_CODE;
console.info(params2);
GM_xmlhttpRequest({
method: "POST",
url: "http://pastebin.com/api/api_post.php",
data: params2,
headers: { "Content-Type": "application/x-www-form-urlencoded", Referer: "http://pastebin.com" },
onload: function (response)
{
console.log(response);
}
});
}
Pastebin API: Bad API Request
I am unable to get the script below to work. I am trying to paste code using the PasteBin API.
After acquiring a valid APIUSERKEY, pasteFile() is executed but I get "Bad API request, invalid api_option" onload. I am not sure what I am doing wrong.