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.

267 lines
8.9 KiB

@model Teknik.Areas.Help.ViewModels.HelpViewModel
@*@using Teknik.Pygments*@
<bundle src="css/help.min.css" append-version="true"></bundle>
<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="#">Paste Service</a></li>
</ol>
<div class="row api">
<h2><b>Paste Service</b></h2>
<hr>
<p>This is a description of the API commands available for the Paste service.</p>
<h3>Submit a Paste</h3>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Paste")</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>Authorization</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 paste 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>code</code>
</td>
<td>
<code>string</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
<strong>Required</strong>
The text that will be submitted as the paste content.
</td>
</tr>
<tr>
<td>
<code>title</code>
</td>
<td>
<code>string</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
The title for the paste.
</td>
</tr>
<tr>
<td>
<code>syntax</code>
</td>
<td>
<code>string</code>
</td>
<td>
text
</td>
<td>
The syntax of the pasted code.
<br />
This can be one of the following:
<select name="format" class="selectpicker">
@foreach (var format in HighlightHelper.Languages)
{
<option value="@(format.Key)">@(format.Key)</option>
}
</select>
</td>
</tr>
<tr>
<td>
<code>expireUnit</code>
</td>
<td>
<code>string</code>
</td>
<td>
<var>never</var>
</td>
<td>
The expiration type for the paste. Possible values are <code>view</code> (Number of Views) or a date value <code>minute</code>, <code>hour</code>, <code>day</code>, <code>month</code>, <code>year</code>
</td>
</tr>
<tr>
<td>
<code>expireLength</code>
</td>
<td>
<code>int</code>
</td>
<td>
<var>1</var>
</td>
<td>
The length of whatever unit you choose before the paste is deleted.
</td>
</tr>
<tr>
<td>
<code>password</code>
</td>
<td>
<code>string</code>
</td>
<td>
<var>NULL</var>
</td>
<td>
Specify a password to encrypt and lock the paste with.
</td>
</tr>
<tr>
<td>
<code>hide</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<var>false</var>
</td>
<td>
If the paste should be visible in the most recent pastes list.
</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":{"id":<var>id</var>, "url":"<var>url</var>", "title":"<var>title</var>", "syntax":"<var>text</var>", "expiration":"<var>datetime</var>", "password":"<var>password</var>"}}</code></pre>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>id</code>
</td>
<td>
<code>string</code>
</td>
<td>
The id of the paste.
</td>
</tr>
<tr>
<td>
<code>url</code>
</td>
<td>
<code>string</code>
</td>
<td>
The direct url to the paste.
</td>
</tr>
<tr>
<td>
<code>title</code>
</td>
<td>
<code>string</code>
</td>
<td>
The title of the paste.
</td>
</tr>
<tr>
<td>
<code>syntax</code>
</td>
<td>
<code>string</code>
</td>
<td>
The syntax of the pasted code.
</td>
</tr>
<tr>
<td>
<code>expiration</code>
</td>
<td>
<code>datetime</code>
</td>
<td>
The date of expiration of the paste.
</td>
</tr>
<tr>
<td>
<code>password</code>
</td>
<td>
<code>string</code>
</td>
<td>
The password of the paste.
</td>
</tr>
</tbody>
</table>
<h4>Example</h4>
<pre><code>$ curl --data "title=Paste%20Title&expireUnit=view&expireLength=3" --data-urlencode "code=This is my test code." @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
<p>
This will submit the paste with a title and expiration when the paste has viewed 3 times.
</p>
</div>
</div>