The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

API.cshtml 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. @model Teknik.Areas.Help.ViewModels.HelpViewModel
  2. <bundle src="css/help.min.css" append-version="true"></bundle>
  3. <div class="container">
  4. <ol class="breadcrumb">
  5. <li><a href="@Url.SubRouteUrl("help", "Help.Index")">Help Index</a></li>
  6. <li class="active"><a href="#">API</a></li>
  7. </ol>
  8. <div class="row api">
  9. <div class="col-sm-4">
  10. <h3><b>API Versions</b></h3>
  11. <h4>Version 1</h4>
  12. <p>
  13. <ul class="list-unstyled">
  14. <li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = "v1", service = "Upload" })">Upload Service</a></li>
  15. <li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = "v1", service = "Paste" })">Paste Service</a></li>
  16. <li><a href="@Url.SubRouteUrl("help", "Help.API", new { version = "v1", service = "Shorten" })">Url Shortening</a></li>
  17. </ul>
  18. </p>
  19. </div>
  20. <div class="col-sm-8">
  21. <h2><b>Teknik API</b></h2>
  22. <hr>
  23. <p>
  24. The Teknik API is free for everyone to use, and is defined on a per service basis.
  25. <br />
  26. <br />
  27. 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>
  28. </p>
  29. <h3>Authentication</h3>
  30. <p>
  31. 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.
  32. <br />
  33. <br />
  34. <h4>OAuth2 token (sent in a header)</h4>
  35. <code>curl -H "Authorization: token <i>OATH-TOKEN</i>" @Url.SubRouteUrl("api", "Api.Index")v@(Config.ApiConfig.Version)/</code>
  36. <br />
  37. <br />
  38. 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.
  39. <pre><code>$ curl -H &lt;OAUTH-TOKEN&gt; --data code="Test" @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
  40. </p>
  41. <h3>Responses</h3>
  42. <p>
  43. All responses are returned as json. The returned json can contain any of the following sections.
  44. <br />
  45. <br />
  46. <strong>Results</strong>
  47. <pre><code>{"result":{"&lt;resultData&gt;":"&lt;value&gt;"}}</code></pre>
  48. <strong>Errors</strong>
  49. <pre><code>{"error":{"message":"&lt;errorMessage&gt;"}}</code></pre>
  50. </p>
  51. <hr />
  52. </div>
  53. </div>
  54. </div>