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.

Paste.cshtml 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. @model Teknik.Areas.Help.ViewModels.HelpViewModel
  2. @using Teknik.Helpers
  3. @Styles.Render("~/Content/help");
  4. <div class="container">
  5. <div class="row api">
  6. <h2><b>Paste Service</b></h2>
  7. <hr>
  8. <p>This is a description of the API commands available for the Paste service.</p>
  9. <h3>Submit a Paste</h3>
  10. <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
  11. <h4>Parameters</h4>
  12. <table>
  13. <thead>
  14. <tr>
  15. <th>Name</th>
  16. <th>Type</th>
  17. <th>Default</th>
  18. <th>Description</th>
  19. </tr>
  20. </thead>
  21. <tbody>
  22. <tr>
  23. <td>
  24. <code>code</code>
  25. </td>
  26. <td>
  27. <code>string</code>
  28. </td>
  29. <td>
  30. <var>NULL</var>
  31. </td>
  32. <td>
  33. <strong>Required</strong>
  34. The text that will be submitted as the paste content.
  35. </td>
  36. </tr>
  37. <tr>
  38. <td>
  39. <code>title</code>
  40. </td>
  41. <td>
  42. <code>string</code>
  43. </td>
  44. <td>
  45. <var>NULL</var>
  46. </td>
  47. <td>
  48. The title for the paste.
  49. </td>
  50. </tr>
  51. <tr>
  52. <td>
  53. <code>syntax</code>
  54. </td>
  55. <td>
  56. <code>string</code>
  57. </td>
  58. <td>
  59. auto-detect
  60. </td>
  61. <td>
  62. The syntax of the pasted code.
  63. <br />
  64. This can be one of the following:
  65. <select name="format" class="selectpicker">
  66. @foreach (KeyValuePair<string, string> format in Constants.HIGHLIGHTFORMATS)
  67. {
  68. <option value="@format.Value">@format.Key</option>
  69. }
  70. </select>
  71. </td>
  72. </tr>
  73. <tr>
  74. <td>
  75. <code>expireUnit</code>
  76. </td>
  77. <td>
  78. <code>string</code>
  79. </td>
  80. <td>
  81. <var>never</var>
  82. </td>
  83. <td>
  84. The expiration type for the paste. Possible values are <code>view</code> (Number of Views) or a date value <code>minute</code>, <code>hour</code>, <code>day</code>, <code>month</code>, <code>year</code>
  85. </td>
  86. </tr>
  87. <tr>
  88. <td>
  89. <code>expireLength</code>
  90. </td>
  91. <td>
  92. <code>int</code>
  93. </td>
  94. <td>
  95. <var>1</var>
  96. </td>
  97. <td>
  98. The length of whatever unit you choose before the paste is deleted.
  99. </td>
  100. </tr>
  101. <tr>
  102. <td>
  103. <code>password</code>
  104. </td>
  105. <td>
  106. <code>string</code>
  107. </td>
  108. <td>
  109. <var>NULL</var>
  110. </td>
  111. <td>
  112. Specify a password to encrypt and lock the paste with.
  113. </td>
  114. </tr>
  115. <tr>
  116. <td>
  117. <code>hide</code>
  118. </td>
  119. <td>
  120. <code>bool</code>
  121. </td>
  122. <td>
  123. <var>false</var>
  124. </td>
  125. <td>
  126. If the paste should be visible in the most recent pastes list.
  127. </td>
  128. </tr>
  129. </tbody>
  130. </table>
  131. <h4>Response</h4>
  132. <pre><code>{"result":{"id":<var>id</var>, "url":"<var>url</var>", "title":"<var>title</var>", "syntax":"<var>auto-detect</var>", "expiration":"<var>datetime</var>", "password":"<var>password</var>"}}</code></pre>
  133. <table>
  134. <thead>
  135. <tr>
  136. <th>Name</th>
  137. <th>Type</th>
  138. <th>Description</th>
  139. </tr>
  140. </thead>
  141. <tbody>
  142. <tr>
  143. <td>
  144. <code>id</code>
  145. </td>
  146. <td>
  147. <code>string</code>
  148. </td>
  149. <td>
  150. The id of the paste.
  151. </td>
  152. </tr>
  153. <tr>
  154. <td>
  155. <code>url</code>
  156. </td>
  157. <td>
  158. <code>string</code>
  159. </td>
  160. <td>
  161. The direct url to the paste.
  162. </td>
  163. </tr>
  164. <tr>
  165. <td>
  166. <code>title</code>
  167. </td>
  168. <td>
  169. <code>string</code>
  170. </td>
  171. <td>
  172. The title of the paste.
  173. </td>
  174. </tr>
  175. <tr>
  176. <td>
  177. <code>syntax</code>
  178. </td>
  179. <td>
  180. <code>string</code>
  181. </td>
  182. <td>
  183. The syntax of the pasted code.
  184. </td>
  185. </tr>
  186. <tr>
  187. <td>
  188. <code>expiration</code>
  189. </td>
  190. <td>
  191. <code>datetime</code>
  192. </td>
  193. <td>
  194. The date of expiration of the paste.
  195. </td>
  196. </tr>
  197. <tr>
  198. <td>
  199. <code>password</code>
  200. </td>
  201. <td>
  202. <code>string</code>
  203. </td>
  204. <td>
  205. The password of the paste.
  206. </td>
  207. </tr>
  208. </tbody>
  209. </table>
  210. <h4>Example</h4>
  211. <pre><code>$ curl --data "title=Paste%20Title&expireUnit=view&expireLength=3" --data-urlencode "code=This is my test code." @Url.SubRouteUrl("api", "API.v1.Paste")</code></pre>
  212. <p>
  213. This will submit the paste with a title and expiration when the paste has viewed 3 times.
  214. </p>
  215. </div>
  216. </div>