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 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:
http://snipplr.com/all/language/javascript http://snipplr.com/all/language/c-plus-plus http://snipplr.com/all/language/c-sharp http://snipplr.com/all/language/cold-fusion
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.
Comments
Textmate Bundle
Thanks, Tyler! Here’s an e/TextMate snippet I made using the new API:
http://snipplr.com/view/2044/post-snippet-to-snipplr/
I’ve also updated my own Snipplr plugin for Textmate. My bundle uses the new tm_dialog abilities so the Get and Post forms are more intuitive. It now uses the new language API to attempt to set the snippet being posted to the correct language based on the current document type. In addition, it has a new experimental search function to allow you to search all snippets, not just your own.
To download it or for more info go to http://elaptics.co.uk/index.php?id=35
Your new Textmate plugin is awesome, Andy. Great work!
I’ve got a slight fever today, maybe that’s why I just cant figure out how to add others snippets as my favorites… Or do I have to submit snippets of my own before I can do that?
Click on the star beside each snippet’s name to add it to your favorites.