mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Reworked API help docs
This commit is contained in:
parent
894c1b2974
commit
9846475056
@ -23,22 +23,36 @@
|
|||||||
<h2><b>Teknik API</b></h2>
|
<h2><b>Teknik API</b></h2>
|
||||||
<hr>
|
<hr>
|
||||||
<p>
|
<p>
|
||||||
The Teknik API is free for everyone to use, and is defined on a per service basis.
|
The Teknik API is free for all accounts to use, and is defined on a per service basis.
|
||||||
<br />
|
<br />
|
||||||
<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>
|
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>
|
</p>
|
||||||
<h3>Authentication</h3>
|
<h3>Authentication</h3>
|
||||||
<p>
|
<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 methods can be used.
|
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 />
|
||||||
<br />
|
<br />
|
||||||
<h4>OAuth2 token (sent in a header)</h4>
|
<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>
|
<code>curl -H "Authorization: token <i>OATH-TOKEN</i>" @Url.SubRouteUrl("api", "Api.Index")/v@(Config.ApiConfig.Version)/</code>
|
||||||
<br />
|
<br />
|
||||||
<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><OAUTH-TOKEN></code> with your access token.
|
For example, if you're accessing the API via cURL, the following command would associate the create paste with your account. Just replace <code><OAUTH-TOKEN></code> with your access token.
|
||||||
<pre><code>$ curl -H <OAUTH-TOKEN> --data code="Test" @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
|
<pre><code>$ curl -H <OAUTH-TOKEN> --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><XXXXXXXXXXXXXXXXXXXX></code> with your Auth Token.
|
||||||
|
<pre><code>$ curl -H "AuthToken <XXXXXXXXXXXXXXXXXXXX>"" --data code="Test" @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
|
||||||
</p>
|
</p>
|
||||||
<h3>Responses</h3>
|
<h3>Responses</h3>
|
||||||
<p>
|
<p>
|
||||||
|
Loading…
Reference in New Issue
Block a user