ORCID – a taster of the API

Posted on September 13, 2011

2


As the official draft API (googledoc) is both in flux and read-protected so that only those invited can see it, I am unable to give you a complete view of how things are shaping up.

However, I can relay a number of key points that everyone involved is concerned about:

  • It must have sensible (some may say RESTful) URLs
  • Human and machine-readable data is a must via
    • Content-negotiation,
    • and optionally, “suffix” negotiation (adding a “.xml” or “/xml”) for convenience.
  • OAuth is the current plan to share trust, allowing users the greatest control over what and who has access to their live profile data.
  • Profile creation/editing “By Proxy” is important, but shouldn’t take any control of the researcher’s basic profile information from the researcher themselves.

Some code!

Gudmundur A. Thorisson (University of Leicester and a member of the ORCID Technical Advisory Group) has put together an emulation of certain portions of the ORCID API, including some of the OAuth parts:

https://github.com/gthorisson/orcid-sandbox

Get the code from github and making sure you already have Rails/Ruby installed:


$ cd orcid-sandbox
$ bundle install
$ bundle exec rake db:migrate
$ bundle exec rake db:setup
$ rails server -p 3001 -d

(you may need “$ scripts/rails server -p 3001 -d)

Once you have the code up and running, you should be able to log in, make accounts and so on.

# OAuth-protected access to profile
[mummi@cambozola-2]curl  http://localhost:3001/profile -H "Accept: text/xml"  -I 
HTTP/1.1 401 Unauthorized 
X-Ua-Compatible: IE=Edge
Connection: Keep-Alive
Content-Type: text/html; charset=utf-8
Date: Thu, 08 Sep 2011 12:20:50 GMT
Server: WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12)
X-Runtime: 0.087887
Content-Length: 0
Cache-Control: no-cache
# Public access to profile
[mummi@cambozola-2]curl  http://localhost:3001/cid/0723-1814-6587-5983 -H "Accept: text/xml" -I 
HTTP/1.1 200 OK 
X-Ua-Compatible: IE=Edge
Etag: "390c3560fce0064d65dd1373799f13d0"
Connection: Keep-Alive
Content-Type: application/xml; charset=utf-8
Date: Thu, 08 Sep 2011 12:20:49 GMT
Server: WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12)
X-Runtime: 0.035443
Content-Length: 0
Cache-Control: max-age=0, private, must-revalidate


# Sample response (from Mike's XML examples)
[mummi@cambozola-2]curl  http://localhost:3001/cid/0723-1814-6587-5983 -H "Accept: text/xml" 
<?xml version="1.0" encoding="UTF-8"?>
<orcid-bio-response xsi:schemaLocation="http://www.orcid.org/ns/orcid_bio_response_1.0.xsd"
    xmlns="http://www.orcid.org/ns/bio_response"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <response_version>1.0</response_version>
    <response_summary>
        <submission-date>09-10-2012 15:50:01</submission-date>
        <completion-date>09-10-2012 15:50:07</completion-date>
        <total-researchers-found>1</total-researchers-found>
        <!-- error message, if applicable -->
        <!-- unable to connect to ORCID, no matching researchers etc -->
        <error-desc>No researcher found for this institution.</error-desc>
    </response_summary>
    <profileList>
        <researcher-profile>
            <!--  ORCID elements will be present for every researcher found -->
            <orcid>XXXXXXXXXXXXXX</orcid>
            <!-- In short, researcher has claimed the profile if confirmed=true-->
            <confirmed>true</confirmed>
            <firstName>Josiah</firstName>
            <lastName>Carberry</lastName>
            <middleName>Stinkney</middleName>
            <other-names>
                <other-name>J. Carberry</other-name>
                <other-name>J. S. Carberry</other-name>
            </other-names>
            <researcher-urls>
                <url>http://library.brown.edu/about/hay/carberry.php</url>
                <url>http://en.wikipedia.org/wiki/Josiah_S._Carberry</url>
                <url>http://www.brown.edu/Administration/News_Bureau/Databases/Encyclopedia/search.php?serial=C0070</url>
            </researcher-urls>
            <institution>
                <name>Brown University</name>
                <address>
                        <addressLine1>38 Brown Street / Box 1920</addressLine1> 
                        <city>Providence</city>
                        <state-or-province>Rhode Island</state-or-province>
                        <country>United States</country>
                        <postalcode>02912</postalcode>
                    </address>
                <departmentName>Psychoceramics</departmentName>
                <departmentName>High Energy Metaphysics</departmentName>
                <role>Researcher (Academic)</role>
                <start-date>1929</start-date>
            </institution>
            <bulk-institution>Brown University</bulk-institution>
            <sponsor>Brown University Library</sponsor>
            <affiliate-institution>
                <name> Wesleyan University</name>
                <address>
                        <addressLine1>Wesleyan University</addressLine1>
                        <addressLine2>Czech-Republic</addressLine2> 
                        <city>Middletown</city>
                        <state-or-province>Connecticut</state-or-province>
                        <country>United States</country>
                        <postalcode>06459</postalcode>
                    </address>
                <departmentName>Bilocation</departmentName>
                <role>Researcher (Academic)</role>
                <start-date>1930</start-date>
            </affiliate-institution>
        </researcher-profile>
    </profileList>
</orcid-bio-response>
About these ads
Posted in: ORCID