Skip to content Skip to sidebar Skip to footer

Making A Simple POST Request With The Pastebin API

I was wondering how I would be able to make a post request to pastebin.com. They have an easy to understand API documentation, but whenever I run a simple POST request I always get

Solution 1:

Finally I made it work like this:

var request = new XMLHttpRequest();

request.open("POST", "https://pastebin.com/api/api_post.php", true);

request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

request.send("api_dev_key=YOUR_KEY_HERE&api_option=paste&api_paste_private=0&api_paste_name=myname.js&api_paste_expire_date=10M&api_paste_format=javascript&api_paste_code=random");

I hope it helps


Post a Comment for "Making A Simple POST Request With The Pastebin API"