The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

324 lines
11 KiB

@model Teknik.Areas.Help.ViewModels.HelpViewModel
@using Teknik.Utilities
@Styles.Render("~/Content/help");
<div class="container">
<ol class="breadcrumb">
<li><a href="@Url.SubRouteUrl("help", "Help.Index")">Help Index</a></li>
<li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = string.Empty, service = string.Empty })">API</a></li>
<li>v1</li>
<li class="active"><a href="#">Upload Service</a></li>
</ol>
<div class="row api">
<h2><b>Upload Service</b></h2>
<hr>
<p>This is a description of the API commands available for the Upload service.</p>
<h3>Upload a File</h3>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Upload")</code></pre>
<h4>Headers</h4>
<table>
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>Default Value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>Authorize</code>
</td>
<td>
<code>Basic <i>Encoding.Base64</i>(&lt;username&gt;:&lt;token&gt;)</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
Basic Authentication to associate the upload with your account.
</td>
</tr>
</tbody>
</table>
<h4>Parameters</h4>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>file</code>
</td>
<td>
<code>file</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
<strong>Required</strong>
The file that you would like to upload.
</td>
</tr>
<tr>
<td>
<code>contentType</code>
</td>
<td>
<code>string</code>
</td>
<td>
<var>no</var>
</td>
<td>
The content-type of the file you are uploading. Only required if the file being uploaded is already encrypted.
</td>
</tr>
<tr>
<td>
<code>encrypt</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<var>true</var>
</td>
<td>
If you want the file to be encrypted server side. This will regenerate the key and/or iv if none are passed in.
</td>
</tr>
<tr>
<td>
<code>saveKey</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<var>true</var>
</td>
<td>
Saves the passed in or generated key to the server. This will make it so that on download, the file will decrypt server side.
</td>
</tr>
<tr>
<td>
<code>key</code>
</td>
<td>
<code>string</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
If you want the file to be decrypted server side, include the key.
</td>
</tr>
<tr>
<td>
<code>keySize</code>
</td>
<td>
<code>int</code>
</td>
<td>
<var>@Model.Config.UploadConfig.KeySize</var>
</td>
<td>
The size of the key provided in bytes. Only needed if encrypting and no key is provided.
</td>
</tr>
<tr>
<td>
<code>iv</code>
</td>
<td>
<code>string</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
If the file has been encrypted and you want it decrypted (Both Server and Client Side), include the iv.
</td>
</tr>
<tr>
<td>
<code>blockSize</code>
</td>
<td>
<code>int</code>
</td>
<td>
<var>@Model.Config.UploadConfig.BlockSize</var>
</td>
<td>
The size of the iv provided in bytes. Only needed if encrypting and no iv is provided.
</td>
</tr>
<tr>
<td>
<code>genDeletionKey</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<var>false</var>
</td>
<td>
Generates a deletion key.
</td>
</tr>
<tr>
<td>
<code>doNotTrack</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<var>false</var>
</td>
<td>
If you do not want the api request to be tracked as defined in the privacy policy.
</td>
</tr>
</tbody>
</table>
<h4>Response</h4>
<pre><code>{"result":{"url":"<var>url</var>", "fileName":"<var>fileName</var>", "contentType":"<var>contentType</var>", "contentLength":<var>contentLength</var>, "key":<var>key</var>, "keySize":<var>keySize</var>, "iv":<var>iv</var>, "blockSize":<var>blockSize</var>, "deletionKey":<var>deletionKey</var>}}</code></pre>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>url</code>
</td>
<td>
<code>string</code>
</td>
<td>
The direct url to the uploaded file. The key is apended to the url as an anchor tag.
</td>
</tr>
<tr>
<td>
<code>fileName</code>
</td>
<td>
<code>string</code>
</td>
<td>
The filename of the uploaded file.
</td>
</tr>
<tr>
<td>
<code>contentType</code>
</td>
<td>
<code>string</code>
</td>
<td>
The MIME file type of the uploaded file.
</td>
</tr>
<tr>
<td>
<code>contentLength</code>
</td>
<td>
<code>integer</code>
</td>
<td>
The size of the uploaded file in bytes.
</td>
</tr>
<tr>
<td>
<code>key</code>
</td>
<td>
<code>string</code>
</td>
<td>
<strong>Optional</strong>
The key that was used to encrypt the file.
</td>
</tr>
<tr>
<td>
<code>keySize</code>
</td>
<td>
<code>int</code>
</td>
<td>
The size of the key used in bytes.
</td>
</tr>
<tr>
<td>
<code>iv</code>
</td>
<td>
<code>string</code>
</td>
<td>
<strong>Optional</strong>
The iv that was used to encrypt the file.
</td>
</tr>
<tr>
<td>
<code>blockSize</code>
</td>
<td>
<code>int</code>
</td>
<td>
The size of the iv used in bytes.
</td>
</tr>
<tr>
<td>
<code>deletionKey</code>
</td>
<td>
<code>string</code>
</td>
<td>
<strong>Optional</strong>
The deletion key for file. Use it as follows: <code>@Url.SubRouteUrl("u", "Upload.Delete", new { file = "file.jpg", key = "deletionKey" })</code>
</td>
</tr>
</tbody>
</table>
<h4>Example</h4>
<pre><code>$ curl -F "genDeletionKey=true" -F "encrypt=true" -F "file=@("@")image.png" @Url.SubRouteUrl("api", "API.v1.Upload")</code></pre>
<p>
This will upload the file <var>image.png</var>, encrypt it, and then generate a deletion key.
</p>
<br />
<br />
</div>
</div>