-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathattach-endpoint.html
60 lines (58 loc) · 2.72 KB
/
attach-endpoint.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
<!DOCTYPE html>
<html>
<head>
<title>Dataset Project -- Documentation</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://caltechlibrary.github.io/css/site.css">
</head>
<body>
<header>
<a href="http://library.caltech.edu" title="link to Caltech Library Homepage"><img src="https://caltechlibrary.github.io/assets/liblogo.gif" alt="Caltech Library logo"></a>
</header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="../">README</a></li>
<li><a href="../user-manual.html">User Manual</a></li>
<li><a href="./">Documentation</a></li>
<li><a href="../how-to/">How To</a></li>
<li><a href="../libdataset/">Libdataset</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/dataset">GitHub</a></li>
</ul>
</nav>
<section>
<h1 id="attach-end-point">Attach (end point)</h1>
<p>Interacting with the <strong>datasetd</strong> web service can be
done with any web client. For documentation purposes I am assuming you
are using <a href="https://curl.se/">curl</a>. This command line program
is available on most POSIX systems including Linux, macOS and
Windows.</p>
<p>Attaches a document to a JSON Document using
<code><KEY></code>, and <code><FILENAME></code>.</p>
<pre><code>`http://localhost:8485/<COLLECTION_ID>/attachment/<KEY>/<FILENAME>`</code></pre>
<p>Requires a “POST” method. The “POST” is expected to be a multi-part
web form providing the source filename in the field “filename”. The
document will be written for JSON document in the attachments sub
directory under <code><KEY></code>.</p>
<h1 id="example">Example</h1>
<p>In this example the <code><COLLECTION_ID></code> is “t1”, the
<code><KEY></code> is “one” and the content upload is “a1.png” in
the home directory “/home/jane.doe”. The <code><SEMVER></code> is
“0.0.1”.</p>
<pre class="shell"><code> curl -X POST -H 'Content-Type: multipart/form-data' \
-F 'filename=@/home/jane.doe/a1.png' \
http://localhost:8485/t1/attachment/one/a1.png</code></pre>
<p>NOTE: The URL contains the filename used in the saved attachment. If
I did not want to call it “a1.png” I could have provided a different
name in the URL path.</p>
</section>
<footer>
<span>© 2022 <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><a href="mailto:[email protected]">Email Us</a></span>
<span>Phone: <a href="tel:+1-626-395-3405">(626)395-3405</a></span>
</footer>
</body>
</html>