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.

API.cshtml 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. @model Teknik.Areas.Help.ViewModels.HelpViewModel
  2. @using Teknik.Utilities
  3. @Styles.Render("~/Content/help");
  4. <div class="container">
  5. <ol class="breadcrumb">
  6. <li><a href="@Url.SubRouteUrl("help", "Help.Index")">Help Index</a></li>
  7. <li class="active"><a href="#">API</a></li>
  8. </ol>
  9. <div class="row api">
  10. <div class="col-sm-4">
  11. <h3><b>API Versions</b></h3>
  12. <h4>Version 1</h4>
  13. <p>
  14. <ul class="list-unstyled">
  15. <li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = "v1", service = "Upload" })">Upload Service</a></li>
  16. <li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = "v1", service = "Paste" })">Paste Service</a></li>
  17. <li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = "v1", service = "Shorten" })">Url Shortening</a></li>
  18. </ul>
  19. </p>
  20. </div>
  21. <div class="col-sm-8">
  22. <h2><b>Teknik API</b></h2>
  23. <hr>
  24. <p>
  25. The Teknik API is free for everyone to use, and is defined on a per service basis.
  26. <br />
  27. <br />
  28. The general API calls can be summarized as follows: <code>@Url.SubRouteUrl("api", "Api.Index")v@(Model.Config.ApiConfig.Version)/<b>Service</b>/<b>Action</b></code>
  29. </p>
  30. <h3>Basic Authentication</h3>
  31. <p>
  32. 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.
  33. <br />
  34. <br />
  35. <h4>Generating Authentication Tokens</h4>
  36. 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.
  37. <br />
  38. <br />
  39. <h4>Using the Authentication Tokens</h4>
  40. To use Basic Authentication with your token, simply send the username and token.
  41. <br />
  42. <br />
  43. 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.
  44. <pre><code>$ curl -u &lt;username&gt;:&lt;token&gt; --data code="Test" @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
  45. </p>
  46. <h3>Responses</h3>
  47. <p>
  48. All responses are returned as json. The returned json can contain any of the following sections.
  49. <br />
  50. <br />
  51. <strong>Results</strong>
  52. <pre><code>{"result":{"&lt;resultData&gt;":"&lt;value&gt;"}}</code></pre>
  53. <strong>Errors</strong>
  54. <pre><code>{"error":{"message":"&lt;errorMessage&gt;"}}</code></pre>
  55. </p>
  56. <hr />
  57. </div>
  58. </div>
  59. </div>