Help : API
It's very easy to play with our API in XML, JSON and Plain Text, you can create and get information from shortcuts, but we scheduled improvements on our API very soon!Topics
Create Shortcuts
(Responses in: XML, JSON or Plain Text)It's very simple to create shortcuts at Snick.me. You can also create nammed shortcuts like http://snick.me/customname using our API. Let's start creating a simple shortcut:
http://snick.me/api/create?url=http://your-url-here.com/
If you want a nammed URL, just add the "name" param in your URL. It's good to be the first param:
http://snick.me/api/create?name=MyCustomURL&url=http://your-url-here.com/
In any case, the awnser of our API it's a XML response containing various informations. This is the structure:
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<status>
<code>OK</code>
</status>
<response>
<type>page</type>
<description>This site does not exist, but is useful to demonstrate things</description>
<mature type="boolean">false</mature>
<shortcut>http://snick.me/mycustomurl</shortcut>
<url>http://www.your-url-here.com/</url>
<created type="datetime">2009-05-21T20:07:20Z</created>
<title>Your URL Here Title</title>
<hits type="integer">0</hits>
<tweets type="integer">0</tweets>
</response>
</hash>
If you look at the "STATUS" node, you can see if has any errors. The possible strings here are:- "OK" - It's OK. Better impossible
- "Err103 - Invalid URL"
- "Err105 - {A different HTTP error here}"
- "Err201 - Invalid shortcut name. @#.\\!/?; chars are not allowed."
- "Err202 - Custom name already taken"
Get Info
(Responses in: XML, JSON or Plain Text)There is no secret to get any shortcut information from Snick.me:
http://snick.me/api/getinfo?s=shortcut-name
The anwser for this requisition it's an XML like:
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<status>
<code>OK</code>
</status>
<response>
<type>page</type>
<description>This site does not exist, but is useful to demonstrate things</description>
<mature type="boolean">false</mature>
<shortcut>http://snick.me/shortcut-name</shortcut>
<url>http://www.some-site-here.com/</url>
<created type="datetime">2009-05-21T20:07:20Z</created>
<title>The site title here</title>
<hits type="integer">233</hits>
<tweets type="integer">17</tweets>
</response>
</hash>
If you look at "STATUS" node, you can see if have any errors. The unique error you can get is the "Not Found" error. This
error applies to shortcuts that don't exist or were blocked for any reason.
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<status>
<code>Not found</code>
</status>
</hash>
Dynamic Tweet
Send your tweet to our API containing one or more large links and Snick.me will give you back your own tweet but with all your URLs shortened in plain text format.Example to send a GET request Dynamic Tweet:
http://snick.me/api/tweet?text=We%20have%20a%20great%20service%20with%20podcasts%20like%20http%3A%2F%2Fpodcast.cbc.ca%2Fwr%2FPlain text return: We have a great service with podcasts like http://snick.me/1b and cool links like http://snick.me/30
wr_20090528.mp3%20and%20cool%20links%20like%20http%3A%2F%2Fuk.geocities.com%2Fbabyfish8%40btinternet.com%2Fhome.html
Example to send a POST request:
Post your tweet in a parameter called "text" to: http://snick.me/api/tweet
Return: Plain text
Tip: We recommed you to use URL Escape to send your tweets
Response Types
There are two kinds of response you can get from Snick.me: XML and JSON. For any request, if you add a .xml or .json response, you'll get it. If you don't specify anything, you'll get a XML.Example to get a PLAIN TEXT awnser:
http://snick.me/api/getinfo.text?s=shortcut-name
http://snick.me/api/create.text?url=http://www.google.com/
Example to get a JSON awnser:
http://snick.me/api/getinfo.json?s=shortcut-name
http://snick.me/api/create.json?url=http://www.google.com/
Example to get a XML awnser:
http://snick.me/api/getinfo.xml?s=shortcut-name
http://snick.me/api/create.xml?url=http://www.google.com/
