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.
 
 
 
 
 

70 lines
4.4 KiB

@model Teknik.Areas.Help.ViewModels.HelpViewModel
<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 class="active"><a href="#">API</a></li>
</ol>
<div class="row api">
<div class="col-sm-4">
<h3><b>API Versions</b></h3>
<h4>Version 1</h4>
<p>
<ul class="list-unstyled">
<li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = "v1", service = "Upload" })">Upload Service</a></li>
<li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = "v1", service = "Paste" })">Paste Service</a></li>
<li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = "v1", service = "Shorten" })">Url Shortening</a></li>
</ul>
</p>
</div>
<div class="col-sm-8">
<h2><b>Teknik API</b></h2>
<hr>
<p>
The Teknik API is free for all accounts to use, and is defined on a per service basis.
<br />
<br />
The general API calls can be summarized as follows: <code>@Url.SubRouteUrl("api", "Api.Index")/v@(Config.ApiConfig.Version)/<b>Service</b>/<b>Action</b></code>
</p>
<h3>Authentication</h3>
<p>
For all API services, you will be required to authenticate to access them. You can either authenticate using Oauth/OpenID Connect, or via an Auth Token. We advise to use OAuth in as many cases as possible, but when unable, Auth Tokens are persistent tokens that give you access to the API only.
<br />
<br />
<h4>OAuth or OpenID Connect</h4>
<p>To authenticate with OAuth or OpenID, you will need to create a client in your <a href="@Url.SubRouteUrl("account", "User.ClientSettings")">Developer Settings</a> to authenticate against. Once created, you can interact with the authentication endpoint via any of the endpoints described in the <a href="https://auth.teknik.io/.well-known/openid-configuration">discovery document</a>.</p>
<br />
<br />
<h4>OAuth2 token (sent in a header)</h4>
<p>To authenticate with an Oauth Token, you need to generate one using the <a href="https://auth.teknik.io/connect/token">token endpoint</a>. To learn more about obtaining a token, you can </p>
<code>curl -H "Authorization: token <i>OATH-TOKEN</i>" @Url.SubRouteUrl("api", "Api.Index")/v@(Config.ApiConfig.Version)/</code>
<br />
<br />
For example, if you're accessing the API via cURL, the following command would associate the create paste with your account. Just replace <code>&lt;OAUTH-TOKEN&gt;</code> with your access token.
<pre><code>$ curl -H &lt;OAUTH-TOKEN&gt; --data code="Test" @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
<br />
<br />
<h4>Auth Token (sent in a header)</h4>
<p>To authenticate with an Auth Token, you can generate tokens in your <a href="@Url.SubRouteUrl("account", "User.AuthTokenSettings")">Developer Settings</a></p>
<code>curl -H "Authorization: AuthToken <i>AUTH-TOKEN</i>" @Url.SubRouteUrl("api", "Api.Index")/v@(Config.ApiConfig.Version)/</code>
<br />
<br />
For example, if you're accessing the API via cURL, the following command would associate the create paste with your account. Just replace <code>&lt;XXXXXXXXXXXXXXXXXXXX&gt;</code> with your Auth Token.
<pre><code>$ curl -H "AuthToken &lt;XXXXXXXXXXXXXXXXXXXX&gt;"" --data code="Test" @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
</p>
<h3>Responses</h3>
<p>
All responses are returned as json. The returned json can contain any of the following sections.
<br />
<br />
<strong>Results</strong>
<pre><code>{"result":{"&lt;resultData&gt;":"&lt;value&gt;"}}</code></pre>
<strong>Errors</strong>
<pre><code>{"error":{"message":"&lt;errorMessage&gt;"}}</code></pre>
</p>
<hr />
</div>
</div>
</div>