I developed a simple API that does exactly what you want.
Pastebin has an API, but it currently doesn't support editing posts.
That is why I needed to create two different "services" specific to pastebin... PASTEBIN and PASTEBIN2
If you don't need editing, use PASTEBIN. Otherwise, use PASTEBIN2.
The first thing you will need is an Unique Developer API Key.
Then you will need an User API Key.
Here are some examples of usage of my script:
Creating a new post
Persist.write({
service : "PASTEBIN",
value : "...",
data : {
api_dev_key : "...",
api_user_key : "...",
},
onload : function (result) {
alert("http://pastebin.com/" + result.key);
}
});
Editing an existing post
Persist.write({
service : "PASTEBIN2",
mode : -1, // prepend
key : "..."
value : "...",
data : {
api_dev_key : "...",
api_user_key : "...",
},
onload : function (result) {
alert("Post #" + result.key + "\nNew value: " + result.value);
}
});
Reading an existing post
Persist.read({
service : "PASTEBIN",
key : "..."
data : {
api_dev_key : "...",
api_user_key : "...",
},
onload : function (result) {
alert("\nValue: " + result.value);
}
});