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 snipplr.com
- Search your snippets and favorites at snipplr.com
- 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.
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.
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 snippet.post 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:
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.
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.
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).
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.
snippet.post – 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
snippet.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.
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.
snippet.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:
- created (datetime when snippet was created)
- snipplr_url (url to view snippet)
- tags (space delimited list of the snippet’s tags)
snippet.post 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.
snippet.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.
user.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.
languages.list returns a list of supported languages in Snipplr. It returns their
pretty name. The
urlname is the value you pass into the
snippet.post method. The
pretty name is a nicely formatted version of
urlname. It’s just there for your reference. This method takes no parameters.
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.
- 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.
- The back and forth paging links are now located at the top and bottom of the page.
- Lots of internal bug fixes.
Here’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.