Showing posts with label json. Show all posts
Showing posts with label json. Show all posts

Tuesday, March 29, 2011

Feature of the Week: API outputs JSON instead of XML

In the last post we introduced a new parameter for our REST API. With the last release another new API feature was introduced which allows for a better usage of BibSonomy in browser based applications. The API is now able to output JSON. Instead of XML, all API request can be switched with the URL parameter format to return JSON. The JSON output of the last post's example with alphabetical ordered tags of the user beate can be accessed by the following request (you need your username and API key to access the URL):

http://www.bibsonomy.org/api/tags?user=beate&start=0&end=100&order=alph&format=json

If you would like to force the API to provide the XML version you need to change the parameter format to format=xml.

Another option to switch between the two output formats is the Accept parameter send to the server in the header of the HTML request. The screenshot below shows the typical XML output (top part of the figure) and parts of the request header (bottom). Besides the typical text/html format, the request asks for application/xml as one output option. If this is changed to application/json the API will send the answer in JSON format.


If you would like to try it yourself you can use the Firefox addon Modify Headers.

We hope you will find the new feature useful. Every feedback is very welcome.

Happy Tagging,
Andreas

Friday, August 29, 2008

Feature of the week: Updated JSON feed

In one of our last posts, we announced the availability of a JSON feed in BibSonomy. It was meant as a lightweight way to get tag clouds for publications only. Since popularity of JSON increased and we got requests to include feeds for other pages as well, we decided to implement JSON feeds for all pages. Those feeds are now available!

For every BibSonomy page you can get a JSON feed of it by prepending json/ to the path part of the URL, e.g., to get the JSON feed for http://www.bibsonomy.org/tag/json, use the page http://www.bibsonomy.org/json/tag/json.
This returns you an Exhibit compatible JSON feed which includes all bookmark and publication posts of the respective page. To include the JSON feed into your Exhibit, add a link to it into the header of your Exhibit HTML code:
<link href="http://www.bibsonomy.org/tag/json?callback=cb" 
type="application/jsonp" 
rel="exhibit/data" 
ex:jsonp-callback="cb" 
/>

Have a look at the list of Andreas' publications to see, what is possible using JSON and Exhibit with only some lines of HTML!

Users of our existing JSON feed should note that the format changed slightly to adopt it to Exhibit's conventions:
  • The tags are now contained in the list with key items and not tags.
  • The name of the tag is expressed using the key label and not name.
  • There are two more lists (types and properties) to allow easier Exhibit integration.

We've already updated the available tag cloud script to fit to the new layout.

Popular Posts