Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
59 lines (59 loc) · 4.21 KB
/
Copy pathindex.html
File metadata and controls
59 lines (59 loc) · 4.21 KB
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
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>dataciteapi</title>
<link rel="stylesheet" href="https://caltechlibrary.github.io/css/site.css">
<link rel="stylesheet" href="https://media.library.caltech.edu/cl-webcomponents/css/code-blocks.css">
<script type="module" src="https://media.library.caltech.edu/cl-webcomponents/copyToClipboard.js"></script>
<script type="module" src="https://media.library.caltech.edu/cl-webcomponents/footer-global.js"></script>
</head>
<body>
<header>
<a href="https://library.caltech.edu"><img src="https://media.library.caltech.edu/assets/caltechlibrary-logo.png" alt="Caltech Library logo"></a>
</header>
<a href="#main-content" class="visually-hidden">skip to main content</a>
<nav>
<ul>
<li><a href="/">All Library Apps</a></li>
<li><a href="index.html">Home</a></li>
<li><a href="LICENSE">LICENSE</a></li>
<li><a href="INSTALL.html">INSTALL</a></li>
<li><a href="user_manual.html">User Manual</a></li>
<!-- <li><a href="about.html">About</a></li> -->
<!-- <li><a href="search.html">Search</a></li> -->
<li><a href="https://github.com/caltechlibrary/dataciteapi">Code Repository</a></li>
</ul>
</nav>
<section id="main-content">
<h1 id="dataciteapi">dataciteapi</h1>
<p>This is a go package for working with the DataCite API. It is
inspired by work my colleague Tom Morrel has done in Python. This
package is meant to follow the guidelines for interacting with the
public API at api.datacite.org. It also follows the same form as the
golang <a href="https://github.com/caltechlibrary/crossrefapi">CrossRef
API</a> developed previously at Caltech Library.</p>
<h2 id="go-package-example">Go package example</h2>
<div class="sourceCode" id="cb1"><pre class="sourceCode go"><code class="sourceCode go"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a> appName <span class="op">:=</span> path<span class="op">.</span>Base<span class="op">(</span>os<span class="op">.</span>Args<span class="op">[</span><span class="dv">0</span><span class="op">])</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a> client<span class="op">,</span> err <span class="op">:=</span> dataciteapi<span class="op">.</span>NewDataCiteClient<span class="op">(</span>appName<span class="op">,</span> <span class="st">"jane.doe@library.example.edu"</span><span class="op">)</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> err <span class="op">!=</span> <span class="ot">nil</span> <span class="op">{</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a> <span class="co">// handle error...</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a> works<span class="op">,</span> err <span class="op">:=</span> client<span class="op">.</span>Works<span class="op">(</span><span class="st">"10.1037/0003-066x.59.1.29"</span><span class="op">)</span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a> </span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a> <span class="cf">if</span> err <span class="op">!=</span> <span class="ot">nil</span> <span class="op">{</span></span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a> <span class="co">// handle error...</span></span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a> <span class="co">// continue processing your "works" result...</span></span></code></pre></div>
<h2 id="command-line-example">Command line example</h2>
<pre><code> dataciteapi -mailto="jane.doe@library.example.edu" works "10.1037/0003-066x.59.1.29"</code></pre>
<h2 id="reference">Reference</h2>
<ul>
<li><a href="https://support.datacite.org/docs/api">DataCite API
Docs</a></li>
<li><a href="http://schema.datacite.org/meta/kernel-4.1/">DataCite
Metadata Schema v4.1</a></li>
</ul>
</section>
<footer-global></footer-global>
</body>
</html>