Archive for the ‘API’ Category

Snipplr Plugin for Eclipse

Published in: API, PluginsPosted by Tyler on 06/06/07

Oliver Nautsch has created snipplr4e – a Snipplr plugin for the Eclipse IDE. The plugin features

  • Preference page to insert and validate your Snipplr API-Key
  • Post a snippet from the eclipse editor to
  • Search your snippets and favorites at
  • Open your snippets and favorites
  • Drag and Drop a snippet from the search result
  • Ctrl+C to copy a snippet from the search result into the clipboard
  • Deleting a snippet at snipplr

Thanks to Oliver for his great work. You can download snipplr4e here.

Snipplr API Working Again

Published in: API, NewsPosted by Tyler on 05/31/07

I’ve been pulling my hair out for the last day trying to figure out why the Snipplr XML-RPC API went down. I noticed that it happened around the time Dreamhost upgraded to PHP 5.2.2. but couldn’t track down the exact cause.

This post from Daniel Jalkut’s blog was the first I had heard of other websites (like every WordPress blog) having similar issues. Turns out, a bug in PHP 5.2.2 makes $HTTP_ RAW_ POST_DATA not set by default. And since the XML-RPC library I rely on uses that variable, kablooey! Goodbye API!

In any case, it’s fixed now.

Snipplr API Updated

Published in: API, DevelopmentPosted by Tyler on 01/30/07

I bet you all thought Snipplr was left for dead, eh? Sorry about that. In the last couple months I’ve gotten married, bought a house, and helped roll out a new service. Things have been busy 🙂

Back to business. I’ve updated the API’s method to allow specifying a language type. To do so, pass an (optional) fourth parameter containing the language ID. What is the language ID you may ask? It’s the URL formatted language name found in all of Snipplr’s URLs. For example:

In these URLs, the language IDs are “javascript”, “c-plus-plus”, “c-sharp”, and “cold-fusion”, respectively.

If that’s not helpful enough, I’ve also added languages.list method which returns a list of language url names and their corresponding pretty names. i.e., c-sharp and C#, c-plus-plus and C++.

You can view the API reference here.

Let me know if you run into any issues.

Updated Snipplr API

Published in: API, Development, NewsPosted by Tyler on 09/20/06

Based on visitor feedback (thanks, Hernán!) I updated the Snipplr API this morning. The snippet.get method now returns a list of the snippet’s tags. Also, I added a much needed snippet.delete method that (you guessed it) lets you delete snippets from your account. Click here for the API documentation.

Free Snipplr T-Shirts Up For Grabs

Published in: API, NewsPosted by Tyler on 07/06/06

As I mentioned in my previous post, I’m looking for people to write Snipplr plugins for their favorite text editors (including TextMate and BBedit) and websites. In return, if the plugin is approved, I’ll send you a free Snipplr t-shirt and list your name on the website.

Info on how to use the new Snipplr API (so you can write a plugin) is available here.

Updated: You might also want to check out the plugin for WordPress I recently released. Viewing the source will give you a good overview of how the API works. (especially if you’re using PHP).

Snipplr API

Published in: API, Development, NewsPosted by Tyler on

Tonight I’m releasing an offical Snipplr API which will allow anyone to write their own plugins to communicate with Snipplr. You can use the API to talk to Snipplr from other websites, your favorite text editor, or any desktop app. It’s up to you. You’re in control now.

The Snipplr API uses the standard XML-RPC protocol and offers the following methods.

  • snippet.list – Returns a list of snippets based on the search criteria you provide.
  • snippet.get – Retrieves the details (including source code) for a given snippet.
  • – Allows you to store a new snippet into Snipplr.
  • snippet.delete – Allows you to delete a snippet.
  • user.checkkey – Validates a user’s API key.
  • languages.list – Returns a list of available languages.

I’d appreciate feedback letting me know about any problems you run into or features you’d like added.

Also, for all the TextMate hackers out there, I’ve got an offer for you. I’d like to replace the current TextMate Snipplr bundle with a more maintainable Ruby version. (The current one is a mess that uses shell scripting.) I only know a little Ruby, so along with their name on Snipplr and my eternal thanks, the first person to send in a good, working Snipplr plugin for TextMate gets a free Snipplr t-shirt 🙂 In fact, if you want to write a plugin for another editor (BBEdit!), and I approve it, I’ll send you a Snipplr t-shirt as well.

Using the API



\n\nsnippet.list returns an XML formatted list of snippets matching the specified criteria. Takes two parameters (must be passed in this order):

  • api_key: Required. The API key of the Snipplr user. Snipplr returns all of this user’s snippets. An error message will be returned if the API key is invalid.

  • tags: Optional. A space delimited list of tags (keywords) to filter the results by. Snipplr returns snippets which contain at least one of the keywords in the snippet’s title or that match one of the snippet’s tags.

  • sort: Optional. Can be one of these three values: “title”, “date”, “random”.

  • limit: Optional. The number of snippets to return.

Note: snippet.list only returns snippets owned by the user or marked as favorites of the user. It does not search all of the snippets on Snipplr.


\n\nsnippet.get returns a snippet’s details. Takes one parameter:

  • snippet_id: Required. The ID of the snippet to fetch. An error message will be returned if the ID is invalid.

snippet.get currently returns the following snippet properties:

  • id
  • user_id
  • username
  • title
  • language
  • comment
  • created (datetime when snippet was created)
  • source
  • snipplr_url (url to view snippet)
  • tags (space delimited list of the snippet’s tags)

\n\ stores a new snippet into Snipplr. Takes four parameters (must be passed in this order):

  • api_key: Required. The API key of the Snipplr user to which the snippet will belong. An error message will be returned if the API key is invalid.

  • title: Required. The title of the snippet.

  • code: Required. The snippet’s source code.

  • tags: Optional. A space delimited list of keywords to tag the snippet with.

  • language: Optional. The language to mark the snippet as. Use the language name found in Snipplr’s URLs. For example, “javascript” or “c-plus-plus”.


\n\nsnippet.delete deletes a snippet from your Snipplr account. Returns 1 on success, 0 if the snippet could not be deleted. Takes two parameters (must be passed in this order):

  • api_key: Required. The API key of the Snipplr user that created the snippet you are deleting. An error message will be returned if the API key is invalid.

  • snippet_id: Required. The ID of the snippet you are deleting.


\n\nuser.checkkey validates a user’s API key. Returns 1 if the key is valid. 0 if not valid. Takes one parameter.

  • api_key: The API key to validate.


\n\nlanguages.list returns a list of supported languages in Snipplr. It returns their urlname and pretty name. The urlname is the value you pass into the method. The pretty name is a nicely formatted version of urlname. It’s just there for your reference. This method takes no parameters.

New Features Today

Published in: API, Development, NewsPosted by Tyler on 07/05/06

I pushed out a new version of Snipplr early this morning. There are a lot of improvements – both above and under the hood. In deciding what to work on over the holiday weekend, I picked out the best suggestions from all the emails I’ve received and combined that list with my own bug fixes.

New Languages

\n\n* AppleScript * Lisp * SVN * XML

New Features

\n\n* You can add your location to your profile. * You can add your website to your profile. * Each user can now pick which language tabs they want to appear throughout the site. This allows me to keep the list short and prevent wrapping as often as possible. * Snipplr’s layout has been change a little, too. The tag cloud was beginning to take up too much room on the page, so I’ve moved it to the side bar (and increased the width of the sidebar).

Update: Added an option to specify the number of snippets per page. (Thanks, Luis!) Also, I recorded a short screencast showing how to drag the language tabs for people who are having problems.


\n\n* The back and forth paging links are now located at the top and bottom of the page. * Lots of internal bug fixes.

Coming Soon

\n\nHere’s what I’m working on currently and plan to roll out this weekend.

  • Code comments. Let users leave comments on other people’s snippets.
  • Snippet ratings. Users can rate snippets 1 – 5 to help others find the best ones quickly.
  • Revamped RSS feeds allowing you to make a feed from any page. This will let you subscribe to individual tags. (Another much requested feature.)
  • Releasing an “official” Snipplr API using XMl-RPC. Right now the TextMate bundle communicates using a simple GET/POST query. I hope having a documented API will encourage developers to write plugins for BBEdit, Vim, Emacs, and all the other text editors out there.
  • I’m also toying with the idea of classifying snippets based on spoken language. So people who only speak English can ignore all the Spanish snippets and vice-versa. Thoughts?

Again, as always, please let me know of any bugs you find or suggestions you have. You can leave your comments below or contact me here.