Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

JSON Feeds and JSON Views – UVa Health Sciences Web Services

JSON is a data exchange tool that has some distinct advantages over XML as Dare Obasanjo notes.  Using Feeds JSON Path Parser to ingest JSON and Views Datasource to output JSON we are hoping to open up our data to web services.  This tutorial is just about Views Datasource, hopefully we’ll get on the eating side of things with feeds soon!

For the two minute magic here you go http://www.youtube.com/watch?v=yc9Uc-2WczI

Usually when we write up documentation it’s to explain something we understand reasonably well (or at least think we do) on this post we’re grateful to Doug Chestnut over at Alderman for recommending JSON, twistor and infojunkie at drupal.org for banging up some code.

This is just a brief review of a simple views plugin with a lot of potential. In general it is becoming more and more apparent that having web services is rapidly eclipsing the value of web sites.  Web services means being able to extend your integral core data to other developers without the shrouds of silly design and such that stem from institutional committee design.  Put the data in the hands of designers and let them run with it.

Settings for JSON

Settings for JSON

All said and done what this means for developers who may have a use for our electronic journals and books data is that by changing a URL they may have direct access to our work as JSON objects – something that SOLR may ingest directly as of 3.1 – for an example on our development server http://drupal.hsl.virginia.edu/e-resource-journals-json/Biochemistry now returns the JSON output of the regular taxonomy view http://drupal.hsl.virginia.edu/e-resource-journals-taxonomy/Biochemistry

JSON Style in views

JSON Style in views

 

Of course now that we have all these lovely services who is it we’re servicing?  That’s a question we’re still working on the answer to, however given that UVa’s main library is outputting JSON and running SOLR we’re hoping we may be able to streamline and consolidate some of our work for our patrons  (fyi for the VIRGO JSON the string change is slightly different http://search.lib.virginia.edu/catalog?q=chestnut now becomes http://search.lib.virginia.edu/catalog.json?q=chestnut- still a simple way of handling data objects.

Additional resources:

http://jsonviewer.stack.hu/ a handy tool for JSON viewing

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web