1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Updated API help articles a little

This commit is contained in:
Uncled1023 2019-01-21 22:39:05 -08:00
parent f346ac718c
commit 5f6172a8ea
5 changed files with 24 additions and 20 deletions

1
.gitignore vendored
View File

@ -267,3 +267,4 @@ __pycache__/
**/appsettings.*.json
**/tempkey.rsa
/ServiceWorker/Properties/launchSettings.json
/IdentityServer/App_Data/Config.json

View File

@ -10,6 +10,7 @@
<ItemGroup>
<Folder Include="Middleware\" />
<Folder Include="App_Data\" />
<Folder Include="wwwroot\" />
</ItemGroup>

View File

@ -28,21 +28,17 @@
<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>Basic Authentication</h3>
<h3>Authentication</h3>
<p>
For some services, you may be required to authenticate to access them, or to associate generated content with your account. In all cases, the same authentication method is used.
For some services, you may be required to authenticate to access them, or to associate generated content with your account. In all cases, the same authentication methods can be used.
<br />
<br />
<h4>Generating Authentication Tokens</h4>
To generate a new authentication token, navigate to your <a href="@Url.SubRouteUrl("user", "User.Settings")">user profile</a> and click the <b>Security</b> tab. There, you can manage your existing tokens and generate new ones.
<h4>OAuth2 token (sent in a header)</h4>
<code>curl -H "Authorization: token <i>OATH-TOKEN</i>" @Url.SubRouteUrl("api", "Api.Index")v@(Config.ApiConfig.Version)/</code>
<br />
<br />
<h4>Using the Authentication Tokens</h4>
To use Basic Authentication with your token, simply send the username and token.
<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;username&gt;</code> with your Teknik username and <code>&lt;token&gt;</code> with your token.
<pre><code>$ curl -u &lt;username&gt;:&lt;token&gt; --data code="Test" @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
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>
</p>
<h3>Responses</h3>
<p>

View File

@ -95,15 +95,21 @@
text
</td>
<td>
The syntax of the pasted code.
<div class="row">
<div class="col-sm-12">The syntax of the pasted code.</div>
</div>
<br />
This can be one of the following:
<select name="format" class="selectpicker">
@foreach (var format in HighlightHelper.Languages.GroupBy(l => l.Value).ToList())
{
<!option value="@(format?.FirstOrDefault().Key)">@(format?.Key)</!option>
}
</select>
<div class="row">
<div class="col-sm-4">This can be one of the following:</div>
<div class="col-sm-8">
<select name="syntax" id="syntax" class="form-control">
@foreach (var format in HighlightHelper.Languages.GroupBy(l => l.Value).ToList())
{
<!option value="@(format?.FirstOrDefault().Key)">@(format?.Key)</!option>
}
</select>
</div>
</div>
</td>
</tr>
<tr>

View File

@ -14,7 +14,7 @@
<hr>
<p>This is a description of the API commands available for the Url Shortening service.</p>
<h3>Shorten a Url</h3>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Shortener")</code></pre>
<pre><code>POST @Url.SubRouteUrl("api", "API.v1.Shorten")</code></pre>
<h4>Headers</h4>
<table>
<thead>
@ -120,7 +120,7 @@
</tbody>
</table>
<h4>Example</h4>
<pre><code>$ curl --data "url=http://www.example.com/long/url/is/long" @Url.SubRouteUrl("api", "API.v1.Shortener")</code></pre>
<pre><code>$ curl --data "url=http://www.example.com/long/url/is/long" @Url.SubRouteUrl("api", "API.v1.Shorten")</code></pre>
<p>
This will shorten the supplied url.
</p>