Update API documentation with API keys
This commit is contained in:
parent
b1e82f8d7f
commit
256ca43d69
|
@ -11,6 +11,11 @@
|
||||||
|
|
||||||
<h2>API</h2>
|
<h2>API</h2>
|
||||||
|
|
||||||
|
{% if using_auth %}
|
||||||
|
<h3>Keys</h3>
|
||||||
|
<p>This instance uses API Keys, therefore you will need to provide a key for uploading and deleting files.<br/> To do so, add the <code>Linx-Api-Key</code> header with your key.</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h3>Uploading a file</h3>
|
<h3>Uploading a file</h3>
|
||||||
|
|
||||||
<p>To upload a file, make a PUT request to <code>{{ siteurl }}upload/</code> and you will get the url of your upload back.</p>
|
<p>To upload a file, make a PUT request to <code>{{ siteurl }}upload/</code> and you will get the url of your upload back.</p>
|
||||||
|
@ -45,19 +50,35 @@
|
||||||
|
|
||||||
<p>Uploading myphoto.jpg</p>
|
<p>Uploading myphoto.jpg</p>
|
||||||
|
|
||||||
|
{% if using_auth %}
|
||||||
|
<pre><code>$ curl -H "Linx-Api-Key: mysecretkey" -T myphoto.jpg {{ siteurl }}upload/
|
||||||
|
{{ siteurl }}myphoto.jpg</code></pre>
|
||||||
|
{% else %}
|
||||||
<pre><code>$ curl -T myphoto.jpg {{ siteurl }}upload/
|
<pre><code>$ curl -T myphoto.jpg {{ siteurl }}upload/
|
||||||
{{ siteurl }}myphoto.jpg</code></pre>
|
{{ siteurl }}myphoto.jpg</code></pre>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<p>Uploading myphoto.jpg with an expiry of 20 minutes</p>
|
<p>Uploading myphoto.jpg with an expiry of 20 minutes</p>
|
||||||
|
|
||||||
|
{% if using_auth %}
|
||||||
|
<pre><code>$ curl -H "Linx-Api-Key: mysecretkey" -H "Linx-Expiry: 1200" -T myphoto.jpg {{ siteurl }}upload/
|
||||||
|
{{ siteurl }}myphoto.jpg</code></pre>
|
||||||
|
{% else %}
|
||||||
<pre><code>$ curl -H "Linx-Expiry: 1200" -T myphoto.jpg {{ siteurl }}upload/
|
<pre><code>$ curl -H "Linx-Expiry: 1200" -T myphoto.jpg {{ siteurl }}upload/
|
||||||
{{ siteurl }}myphoto.jpg</code></pre>
|
{{ siteurl }}myphoto.jpg</code></pre>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<p>Uploading myphoto.jpg with a random filename and getting a json response:</p>
|
<p>Uploading myphoto.jpg with a random filename and getting a json response:</p>
|
||||||
|
|
||||||
|
{% if using_auth %}
|
||||||
|
<pre><code>$ curl -H "Linx-Api-Key: mysecretkey" -H "Accept: application/json" -H "Linx-Randomize: yes" -T myphoto.jpg {{ siteurl }}/upload/
|
||||||
|
{"delete_key":"...","expiry":"0","filename":"f34h4iu.jpg","mimetype":"image/jpeg",
|
||||||
|
"sha256sum":"...","size":"...","url":"{{ steurl }}/f34h4iu.jpg"}</code></pre>
|
||||||
|
{% else %}
|
||||||
<pre><code>$ curl -H "Accept: application/json" -H "Linx-Randomize: yes" -T myphoto.jpg {{ siteurl }}/upload/
|
<pre><code>$ curl -H "Accept: application/json" -H "Linx-Randomize: yes" -T myphoto.jpg {{ siteurl }}/upload/
|
||||||
{"delete_key":"...","expiry":"0","filename":"f34h4iu.jpg","mimetype":"image/jpeg",
|
{"delete_key":"...","expiry":"0","filename":"f34h4iu.jpg","mimetype":"image/jpeg",
|
||||||
"sha256sum":"...","size":"...","url":"{{ steurl }}/f34h4iu.jpg"}</code></pre>
|
"sha256sum":"...","size":"...","url":"{{ steurl }}/f34h4iu.jpg"}</code></pre>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h3>Overwriting a file</h3>
|
<h3>Overwriting a file</h3>
|
||||||
|
|
||||||
|
@ -67,8 +88,13 @@
|
||||||
|
|
||||||
<p>To overwrite myphoto.jpg</p>
|
<p>To overwrite myphoto.jpg</p>
|
||||||
|
|
||||||
|
{% if using_auth %}
|
||||||
|
<pre><code>$ curl -H "Linx-Api-Key: mysecretkey" -H "Linx-Delete-Key: mysecret" -T myphoto.jpg {{ siteurl }}upload/
|
||||||
|
{{ siteurl }}myphoto.jpg</code></pre>
|
||||||
|
{% else %}
|
||||||
<pre><code>$ curl -H "Linx-Delete-Key: mysecret" -T myphoto.jpg {{ siteurl }}upload/
|
<pre><code>$ curl -H "Linx-Delete-Key: mysecret" -T myphoto.jpg {{ siteurl }}upload/
|
||||||
{{ siteurl }}myphoto.jpg</code></pre>
|
{{ siteurl }}myphoto.jpg</code></pre>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h3>Deleting a file</h3>
|
<h3>Deleting a file</h3>
|
||||||
|
|
||||||
|
@ -78,8 +104,13 @@
|
||||||
|
|
||||||
<p>To delete myphoto.jpg</p>
|
<p>To delete myphoto.jpg</p>
|
||||||
|
|
||||||
|
{% if using_auth %}
|
||||||
|
<pre><code>$ curl -H "Linx-Api-Key: mysecretkey" -H "Linx-Delete-Key: mysecret" -X DELETE {{ siteurl }}myphoto.jpg
|
||||||
|
DELETED</code></pre>
|
||||||
|
{% else %}
|
||||||
<pre><code>$ curl -H "Linx-Delete-Key: mysecret" -X DELETE {{ siteurl }}myphoto.jpg
|
<pre><code>$ curl -H "Linx-Delete-Key: mysecret" -X DELETE {{ siteurl }}myphoto.jpg
|
||||||
DELETED</code></pre>
|
DELETED</code></pre>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h3>Information about a file</h3>
|
<h3>Information about a file</h3>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue