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.

Shorten.cshtml 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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><a href="@Url.SubRouteUrl("help", "Help.API", new { version = string.Empty, service = string.Empty })">API</a></li>
  7. <li>v1</li>
  8. <li class="active"><a href="#">Url Shortening</a></li>
  9. </ol>
  10. <div class="row api">
  11. <h2><b>Url Shortening Service</b></h2>
  12. <hr>
  13. <p>This is a description of the API commands available for the Url Shortening service.</p>
  14. <h3>Shorten a Url</h3>
  15. <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Shorten")</code></pre>
  16. <h4>Headers</h4>
  17. <table>
  18. <thead>
  19. <tr>
  20. <th>Name</th>
  21. <th>Value</th>
  22. <th>Default Value</th>
  23. <th>Description</th>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. <tr>
  28. <td>
  29. <code>Authorization</code>
  30. </td>
  31. <td>
  32. <code>Basic <i>Encoding.Base64</i>(&lt;username&gt;:&lt;token&gt;)</code>
  33. </td>
  34. <td>
  35. <var>NULL</var>
  36. </td>
  37. <td>
  38. Basic Authentication to associate the shortened url with your account.
  39. </td>
  40. </tr>
  41. </tbody>
  42. </table>
  43. <h4>Parameters</h4>
  44. <table>
  45. <thead>
  46. <tr>
  47. <th>Name</th>
  48. <th>Type</th>
  49. <th>Default</th>
  50. <th>Description</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. <tr>
  55. <td>
  56. <code>url</code>
  57. </td>
  58. <td>
  59. <code>string</code>
  60. </td>
  61. <td>
  62. <var>NULL</var>
  63. </td>
  64. <td>
  65. <strong>Required</strong>
  66. The url you want to shorten. This url must be an absolute url.
  67. </td>
  68. </tr>
  69. <tr>
  70. <td>
  71. <code>doNotTrack</code>
  72. </td>
  73. <td>
  74. <code>bool</code>
  75. </td>
  76. <td>
  77. <var>false</var>
  78. </td>
  79. <td>
  80. If you do not want the api request to be tracked as defined in the privacy policy.
  81. </td>
  82. </tr>
  83. </tbody>
  84. </table>
  85. <h4>Response</h4>
  86. <pre><code>{"result":{"shortUrl":"<var>shortened url</var>", "originalUrl":"<var>original url</var>"}}</code></pre>
  87. <table>
  88. <thead>
  89. <tr>
  90. <th>Name</th>
  91. <th>Type</th>
  92. <th>Description</th>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. <tr>
  97. <td>
  98. <code>shortUrl</code>
  99. </td>
  100. <td>
  101. <code>string</code>
  102. </td>
  103. <td>
  104. The shortened url.
  105. </td>
  106. </tr>
  107. <tr>
  108. <td>
  109. <code>originalUrl</code>
  110. </td>
  111. <td>
  112. <code>string</code>
  113. </td>
  114. <td>
  115. The original url that was shortened.
  116. </td>
  117. </tr>
  118. </tbody>
  119. </table>
  120. <h4>Example</h4>
  121. <pre><code>$ curl --data "url=http://www.example.com/long/url/is/long" @Url.SubRouteUrl("api", "API.v1.Shorten")</code></pre>
  122. <p>
  123. This will shorten the supplied url.
  124. </p>
  125. </div>
  126. </div>