over 12 years ago
A Content API call to retrieve data from ScienceDirect
XML Definition File
SciVerse applications are specified in an xml definition file. SciVerse applications require a "profile" view to be defined, although the xsd schema does not enforce it.
This example gadget demonstrates an application on the SciVerse platform using the SciVerse APIs. MySimpleSearch.xml is the xml definition file for the MySimpleSearch example gadget.
Authorization and Authentication
The Sciverse platform uses OAuth (Open Authorization) to hand out tokens (or API keys) for identification via APIs instead of requiring user credentials for the application to access Elsevier APIs. By registering as a SciVerse developer and creating an application, you are given an API key for your app. When your application is loaded in the browser, the server sends in addition a security token to the application for the duration of the session. This security token or authToken can be retrieved from the app’s ContextInfo. When making a call to search or retrieve content via the SciVerse APIs, the application must set both the API key and the authToken in the request headers of the request.
Using JSON and JQuery to parse the Response
The Content API by default returns JSON. You can parse the response object to JSON and use JQuery to extract for instance the DOI (Digital Object Identifier) of the article, which you can then can use to retrieve meta-data about the author (for example his affiliation or the number of citations) from the Scopus cluster.
Integration points are the areas where applications appear in SciVerse. In the xml definition file, the integration points are referenced as “views”. One application can define a number of different views: profile (required), canvas (optional), or sciVerseResultsView (optional)
The source code for MySimpleSearch can be downloaded from GitHub:
Download a PDF version of this post here.