瀏覽代碼

Updated API help articles a little

tags/3.0.0^2
Teknikode 1 年之前
父節點
當前提交
5f6172a8ea

+ 1
- 0
.gitignore 查看文件

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

+ 1
- 0
IdentityServer/IdentityServer.csproj 查看文件

@@ -10,6 +10,7 @@

<ItemGroup>
<Folder Include="Middleware\" />
<Folder Include="App_Data\" />
<Folder Include="wwwroot\" />
</ItemGroup>


+ 6
- 10
Teknik/Areas/Help/Views/Help/API/API.cshtml 查看文件

@@ -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>

+ 14
- 8
Teknik/Areas/Help/Views/Help/API/v1/Paste.cshtml 查看文件

@@ -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>

+ 2
- 2
Teknik/Areas/Help/Views/Help/API/v1/Shorten.cshtml 查看文件

@@ -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>

Loading…
取消
儲存