Blogs » Developer Blog » Developer Blog » Su.pr API: simpleshorten and version system

A few new changes have been released regarding the Su.pr API. First off, there is now a simpleshorten api which returns the shortened URL in plain text. This can be used with or without your login and api key for user-unique Su.pr links. Additionally, there is a nifty shortcut for simpleshorten for easy access:

http://su.pr/api?url=http://www.stumbleupon.com

The next piece is important for all of you XML response format users out there. The latest version of the API (1.0) has a significant change in the result output. A node/value pair is now given for the results instead of the “result node” and “value attribute” which was used prior. This should make it easier for some of you to smoothly transition over to using the Su.pr API . To handle this, we have implemented a version system so major changes such as this won’t interrupt your production code. We plan on changing the default version to 1.0 in a week to give time to our awesome early adopters to either update their code or drop in the extra version parameter. The API documentation page now shows up-to-date information on current and default API versions. Here is an example of the XML response differences:

Version 0.95

http://su.pr/api/shorten?longUrl=http://www.stumbleupon.com&format=xml&version=0.95


<supr>
  <
errorCode>0</errorCode>
  <
errorMessage/>
  <
results>
    <
result name="http://www.stumbleupon.com">
      <
item name="hash" value="1SUJk7"/>
      <
item name="shortUrl" value="http://su.pr/1SUJk7"/>
    </
result>
  </
results>
  <
statusCode>OK</statusCode>
</
supr>

Version 1.0

http://su.pr/api/shorten?longUrl=http://www.stumbleupon.com&format=xml&version=1.0


<supr>
  <
errorCode>0</errorCode>
  <
errorMessage/>
  <
results>
    <
nodeKeyVal>
      <
nodeKey>http://www.stumbleupon.com</nodeKey>
      
<hash>1SUJk7</hash>
      <
shortUrl>http://su.pr/1SUJk7</shortUrl>
    
</nodeKeyVal>
  </
results>
  <
statusCode>OK</statusCode>
</
supr>

/StumbleUpon Team profile picture