(Go: >> BACK << -|- >> HOME <<)

StumbleUpon Developers Blog

Monday, July 06, 2009

Su.pr API: simpleshorten and version system

by edmundsalvacion

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>


For more information visit:
http://www.stumbleupon.com/developers/Su.pr_API_documentation/
http://www.stumbleupon.com/developers/Su.pr_API_Release_Notes/



Comments Permalink

Thursday, June 18, 2009

StumbleUpon Developers Blog - And Su.pr API!

by edmundsalvacion

Hi everybody!

Su.pr Click Tracking

Welcome to the new StumbleUpon Developer Blog where we will be frequently posting about the latest StumbleUpon development and technology related news as well as giving all of you a bit of insight into the day to day of the engineering team here at SU. A brief introduction of myself: My name is Edmund Salvacion, a software engineer working with the web applications team at StumbleUpon. My role consists of maintining anything web facing, such as http://www.stumbleupon.com and http://su.pr as well as developing new features for both products. The latest of these features is the topic of today's blog entry: the Su.pr API.

For those of you who are unfamiliar with Su.pr, it is our brand new short url service designed to drive more traffic to your site. Su.pr provides real time analytics for all of your generated links as well as the ability to post your Su.pr links to other social media services such as twitter and facebook. Another unique feature of Su.pr is the ability to schedule posts in the near future, and being the recommendation gurus we are, we will even suggest the best time for you to post based on past activity. All of this, and more to come, are available from the Su.pr homepage. The new Su.pr API will now allow you to leverage the power of Su.pr from within your own applications.

With the first revision of the Su.pr API, we are granted 4 of the main Su.pr pieces of functionality: shorten, expand, post, and schedule. The API uses the simple to use REST request format with responses in JSON and, if you really want to, XML.

 

Example:

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

 

As you can see, a simple constructed URL passing paramters through GET is all you need to get going with Su.pr. While this will be handy for generating short URLS,  the true power of Su.pr is shown when you are posting using your Su.pr user credentials. Authentication is simply done by passing login and apiKey paramters along with your request.

 

Example:

http://su.pr/api/shorten?longUrl=http://www.stumbleupon.com&login=edmundsalvacion&apiKey=fake3c71368f049b699f9ac843c9bkey

 

Adding my login and API key will associate the Su.pr links to my account where I will have access to the awesome analytics. Authentication is also required for you to use the post and schedule APIs. To get an API key, log into Su.pr, and head to your settings page: http://su.pr/settings/. Remember, this is your private API key, so it's best to use it internally within your applications. However, if you still need to, you are able to generate a new key at any given time.

The full documentation is available at http://www.stumbleupon.com/developers/Supr:API_documentation/. It should have all you need to get running so you can shorten and post from your applications in no time. For any additional questions or suggestions, feel free to email me at .  Good luck and happy coding!

-edmundsalvacion

Follow me on twitter to see my Su.pr links in the wild! @edmundsalvacion

P.S. If you would like to be a part of the invite-only Su.pr beta, go to http://su.pr and use the following code: "suprbeta"



Comments Permalink
Page 1 of 1 pages