This repository has been archived by the owner on Aug 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
139 lines (107 loc) · 5.88 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html>
<head>
<title>Caltech Library's Digital Library Development Sandbox</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/site.css">
</head>
<body>
<header>
<a href="http://library.caltech.edu"><img src="/assets/liblogo.gif" alt="Caltech Library logo"></a>
</header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="index.html">README</a></li>
<li><a href="license.html">LICENSE</a></li>
<li><a href="install.html">INSTALL</a></li>
<li><a href="docs/">Documentation</a></li>
<li><a href="https://github.com/caltechlibrary/orcidtools">Github</a></li>
</ul>
</nav>
<section>
<h1>orcidtools</h1>
<p>Orcid Tools</p>
<p>A command line tool called <em>orcid</em>, a set of Bash scripts and Go template for working with the Public ORCID API.</p>
<h2>Configuration</h2>
<p>The <em>orcid</em> tool and Bash scripts share a common configuration. These are set via environment variables.
The following are supported, the first three required.</p>
<ul>
<li>ORCID_API_URL</li>
<li>ORCID_CLIENT_ID</li>
<li>ORCID_CLIENT_SECRET</li>
<li>ORCID_ACCESS_TOKEN (known on successful login to the API)</li>
</ul>
<p>If you want to use the API URL <a href="https://pub.orcid.org">https://pub.orcid.org</a> then you’ll need to register an application
to generate your client id and secret. This is free for most uses, if you
follow the <a href="https://support.orcid.org/knowledgebase/articles/343182">instructions</a></p>
<p>If you want to experiment with the orcid public api to
test code (e.g. say test this package) you can use the Sandbox API which is
full of fake data. ORCID has provided an example client id and
secret described in their <a href="http://members.orcid.org/api/tutorial-retrieve-data-public-api-curl-12-and-earlier">documentation</a>
along with the sandbox API URL of <a href="https://pub.sandbox.orcid.org">https://pub.sandbox.orcid.org</a>.</p>
<p>The bash scripts provided in the repository rely on a few environment variables.
You can define those variables in a Bash script, sourcing that script will then
expose those variables in your current Bash session.</p>
<p>Below is an example of setup script that would be sourced to access the sandbox</p>
<pre><code class="language-shell"> #!/bin/bash
export ORCID_API_URL="https://pub.sandbox.orcid.org"
export ORCID_CLIENT_ID="APP-01XX65MXBF79VJGF"
export ORCID_CLIENT_SECRET="3a87028d-c84c-4d5f-8ad5-38a93181c9e1""
</code></pre>
<h2>the ORCID tool</h2>
<p>The command line tool works simularly to the bash scripts. You source a configuration then run the tool. Unlike
the shell scripts login is automatic so you can focus on the command you need. The command line tool expacts
an ORCID id as a command line parameter so it can get back a specific record.</p>
<pre><code class="language-shell"> . etc/sandbox.sh
orcid -works 0000-0003-0900-6903
</code></pre>
<p>Would list the works for the ORCID id of “0000-0003-0900-6903”. The resulting document would be in JSON form.</p>
<p>Taking things a step further you can generate a BibTeX from the works in your ORCID using the <em>orcid</em> tool and
<a href="https://caltechlibrary.github.io/mkpage">mkpage</a> tool together with the templates included in this repository.</p>
<pre><code class="language-shell"> . etc/sandbox.sh
orcid -works-detailed 0000-0003-0900-6903 > 0000-0003-0900-6903-works.json
mkpage "data=0000-0003-0900-6903-works.json" templates/works-detailed-to-bibtex.tmpl > 0000-0003-0900-6903.bib
</code></pre>
<p>We also include a simple example of tranferring an ORCID profile to a test
file. This works on a record that has standard metadata present.</p>
<pre><code class="language-shell">. etc/sandbox.sh
orcid -works-detailed 0000-0003-4476-2464 > 0000-0003-4476-2464-works.json
mkpage "data=0000-0003-4476-2464-works.json" templates/orcid2txt.tmpl > 0000-0003-0900-6903.txt
</code></pre>
<h2>Working with the scripts</h2>
<p>Assuming you saved this script as “etc/sandbox.sh” you would source it with the command</p>
<pre><code class="language-shell"> . etc/sandbox.sh
</code></pre>
<p>You could then login to the API with</p>
<pre><code class="language-shell"> ./scripts/api-login.sh
</code></pre>
<p>This will provide you with an Access token (you would cut and paste from the console to set that
into the environment). Once <em>ORCID_ACCESS_TOKEN</em> is defined in your environment you then can use
the other scripts to query the ORCID API for profile, bio and works data.</p>
<p>Putting it together</p>
<pre><code class="language-shell"> . etc/sandbox.sh
./scripts/api-login.sh
# Cut and past the 'export ORCID_ACCESS_TOKEN' line into the console
# Then you can get the "works" for 0000-0003-0900-6903 with
./scripts/api-get-works.sh 0000-0003-0900-6903
</code></pre>
<h2>Reference</h2>
<ul>
<li><a href="http://orcid.org">orcid.org</a></li>
<li><a href="http://members.orcid.org/api/introduction-orcid-public-api">ORCID Public API Documentation</a></li>
<li><a href="http://members.orcid.org/api/tutorial-retrieve-orcid-id-curl-v12-and-earlier">Tutorial on getting ORCID with CURL</a></li>
<li><a href="http://members.orcid.org/api/code-examples">Code Examples</a></li>
<li><a href="http://members.orcid.org/api/tutorial-searching-api-12-and-earlier">Useful ORCID API end points</a></li>
</ul>
</section>
<footer>
<span><h1><A href="http://caltech.edu">Caltech</a></h1></span>
<span>© 2018 <a href="https://www.library.caltech.edu/copyright">Caltech library</a></span>
<address>1200 E California Blvd, Mail Code 1-32, Pasadena, CA 91125-3200</address>
<span>Phone: <a href="tel:+1-626-395-3405">(626)395-3405</a></span>
<span><a href="mailto:[email protected]">Email Us</a></span>
<a class="cl-hide" href="sitemap.xml">Site Map</a>
</footer>
</body>
</html>