From 9846475056c9f0475be9b3622de2144ba7797296 Mon Sep 17 00:00:00 2001 From: Uncled1023 Date: Mon, 6 Dec 2021 18:20:09 -0800 Subject: [PATCH] Reworked API help docs --- Teknik/Areas/Help/Views/Help/API/API.cshtml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Teknik/Areas/Help/Views/Help/API/API.cshtml b/Teknik/Areas/Help/Views/Help/API/API.cshtml index eca15f5..c64a1b9 100644 --- a/Teknik/Areas/Help/Views/Help/API/API.cshtml +++ b/Teknik/Areas/Help/Views/Help/API/API.cshtml @@ -23,22 +23,36 @@

Teknik API


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

The general API calls can be summarized as follows: @Url.SubRouteUrl("api", "Api.Index")/v@(Config.ApiConfig.Version)/Service/Action

Authentication

- 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. +
+
+

OAuth or OpenID Connect

+

To authenticate with OAuth or OpenID, you will need to create a client in your Developer Settings to authenticate against. Once created, you can interact with the authentication endpoint via any of the endpoints described in the discovery document.



OAuth2 token (sent in a header)

+

To authenticate with an Oauth Token, you need to generate one using the token endpoint. To learn more about obtaining a token, you can

curl -H "Authorization: token OATH-TOKEN" @Url.SubRouteUrl("api", "Api.Index")/v@(Config.ApiConfig.Version)/

For example, if you're accessing the API via cURL, the following command would associate the create paste with your account. Just replace <OAUTH-TOKEN> with your access token.
$ curl -H <OAUTH-TOKEN> --data code="Test" @Url.SubRouteUrl("api", "API.v1.Paste")
+
+
+

Auth Token (sent in a header)

+

To authenticate with an Auth Token, you can generate tokens in your Developer Settings

+ curl -H "Authorization: AuthToken AUTH-TOKEN" @Url.SubRouteUrl("api", "Api.Index")/v@(Config.ApiConfig.Version)/ +
+
+ For example, if you're accessing the API via cURL, the following command would associate the create paste with your account. Just replace <XXXXXXXXXXXXXXXXXXXX> with your Auth Token. +
$ curl -H "AuthToken <XXXXXXXXXXXXXXXXXXXX>"" --data code="Test" @Url.SubRouteUrl("api", "API.v1.Paste")

Responses