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 8.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. @model Teknik.Areas.Help.ViewModels.HelpViewModel
  2. @*@using Teknik.Pygments*@
  3. <bundle src="css/help.min.css" append-version="true"></bundle>
  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="#">Paste Service</a></li>
  10. </ol>
  11. <div class="row api">
  12. <h2><b>Paste Service</b></h2>
  13. <hr>
  14. <p>This is a description of the API commands available for the Paste service.</p>
  15. <h3>Submit a Paste</h3>
  16. <pre><code>POST @Url.SubRouteUrl("api", "API.v1.Paste")</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>Authorization</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 paste 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>code</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 text that will be submitted as the paste content.
  68. </td>
  69. </tr>
  70. <tr>
  71. <td>
  72. <code>title</code>
  73. </td>
  74. <td>
  75. <code>string</code>
  76. </td>
  77. <td>
  78. <var>NULL</var>
  79. </td>
  80. <td>
  81. The title for the paste.
  82. </td>
  83. </tr>
  84. <tr>
  85. <td>
  86. <code>syntax</code>
  87. </td>
  88. <td>
  89. <code>string</code>
  90. </td>
  91. <td>
  92. text
  93. </td>
  94. <td>
  95. The syntax of the pasted code.
  96. <br />
  97. This can be one of the following:
  98. <select name="format" class="selectpicker">
  99. @foreach (var format in HighlightHelper.Languages)
  100. {
  101. <option value="@(format.Key)">@(format.Key)</option>
  102. }
  103. </select>
  104. </td>
  105. </tr>
  106. <tr>
  107. <td>
  108. <code>expireUnit</code>
  109. </td>
  110. <td>
  111. <code>string</code>
  112. </td>
  113. <td>
  114. <var>never</var>
  115. </td>
  116. <td>
  117. 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>
  118. </td>
  119. </tr>
  120. <tr>
  121. <td>
  122. <code>expireLength</code>
  123. </td>
  124. <td>
  125. <code>int</code>
  126. </td>
  127. <td>
  128. <var>1</var>
  129. </td>
  130. <td>
  131. The length of whatever unit you choose before the paste is deleted.
  132. </td>
  133. </tr>
  134. <tr>
  135. <td>
  136. <code>password</code>
  137. </td>
  138. <td>
  139. <code>string</code>
  140. </td>
  141. <td>
  142. <var>NULL</var>
  143. </td>
  144. <td>
  145. Specify a password to encrypt and lock the paste with.
  146. </td>
  147. </tr>
  148. <tr>
  149. <td>
  150. <code>hide</code>
  151. </td>
  152. <td>
  153. <code>bool</code>
  154. </td>
  155. <td>
  156. <var>false</var>
  157. </td>
  158. <td>
  159. If the paste should be visible in the most recent pastes list.
  160. </td>
  161. </tr>
  162. <tr>
  163. <td>
  164. <code>doNotTrack</code>
  165. </td>
  166. <td>
  167. <code>bool</code>
  168. </td>
  169. <td>
  170. <var>false</var>
  171. </td>
  172. <td>
  173. If you do not want the api request to be tracked as defined in the privacy policy.
  174. </td>
  175. </tr>
  176. </tbody>
  177. </table>
  178. <h4>Response</h4>
  179. <pre><code>{"result":{"id":<var>id</var>, "url":"<var>url</var>", "title":"<var>title</var>", "syntax":"<var>text</var>", "expiration":"<var>datetime</var>", "password":"<var>password</var>"}}</code></pre>
  180. <table>
  181. <thead>
  182. <tr>
  183. <th>Name</th>
  184. <th>Type</th>
  185. <th>Description</th>
  186. </tr>
  187. </thead>
  188. <tbody>
  189. <tr>
  190. <td>
  191. <code>id</code>
  192. </td>
  193. <td>
  194. <code>string</code>
  195. </td>
  196. <td>
  197. The id of the paste.
  198. </td>
  199. </tr>
  200. <tr>
  201. <td>
  202. <code>url</code>
  203. </td>
  204. <td>
  205. <code>string</code>
  206. </td>
  207. <td>
  208. The direct url to the paste.
  209. </td>
  210. </tr>
  211. <tr>
  212. <td>
  213. <code>title</code>
  214. </td>
  215. <td>
  216. <code>string</code>
  217. </td>
  218. <td>
  219. The title of the paste.
  220. </td>
  221. </tr>
  222. <tr>
  223. <td>
  224. <code>syntax</code>
  225. </td>
  226. <td>
  227. <code>string</code>
  228. </td>
  229. <td>
  230. The syntax of the pasted code.
  231. </td>
  232. </tr>
  233. <tr>
  234. <td>
  235. <code>expiration</code>
  236. </td>
  237. <td>
  238. <code>datetime</code>
  239. </td>
  240. <td>
  241. The date of expiration of the paste.
  242. </td>
  243. </tr>
  244. <tr>
  245. <td>
  246. <code>password</code>
  247. </td>
  248. <td>
  249. <code>string</code>
  250. </td>
  251. <td>
  252. The password of the paste.
  253. </td>
  254. </tr>
  255. </tbody>
  256. </table>
  257. <h4>Example</h4>
  258. <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>
  259. <p>
  260. This will submit the paste with a title and expiration when the paste has viewed 3 times.
  261. </p>
  262. </div>
  263. </div>