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

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