A tiny little dpaste.com API

When I created dpaste, I tried to make it both a simple browser-based tool and a simple RESTful API. With very little work you could write a script that created a new paste item with a single POST.

Over the life of the site a few people have discovered and played with that “secret” API. I’ve now made it a bit more official. The new API has its own URL (versioned, even!) and is more tolerant of missing data, just like the web form.

The URL is http://dpaste.com/api/v1/. In a web browser you’ll see just a terse line of instructions. Here’s a one-line usage example for unixy people. It takes text on stdin and returns the URL of the newly created paste.

curl -si -F 'content=<-' http://dpaste.com/api/v1/ | grep ^Location: | colrm 1 10

Support disclaimer: Depending on your version of curl and your shell some of those options may need twiddling. But in a low-tech way it’s kind of cool, isn’t it? (Figuring out how to get curl to read stdin was a new one for me, so the novelty is high at the moment.)

Anyway, use and enjoy as you wish!


mikele commented :

hey thanks for this!! btw how can I specify the syntax of the snippet???


Paul commented :

mikele: Set the “language” field. Look at the source of the dpaste.com form to see the options.


sm4rt h4ck3r commented :

dpaste is fantastic! Simply fantastic… You did an Impressive work Paul, really!

  1. Its secured than others.
  2. It uses auto delete, so it is great for your server space.
  3. It converts it all in normal text and gives a url, wow!
  4. It is FREE!

My request: Can you please start something like “Tutorials” for python and/or perl.. Some websites do offer but they are just not so good..

PS: If you start tutorials, me and my team will be glad to learn and click on your ads too ;-)


Griffin commented :

Love it, using it now for an IRC bot (hope you don’t mind!). Thanks for the API <3


Paul commented :

Excellent! That’s exactly the sort of thing I wanted to enable. Thanks for using it.

Share: