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.

Api.cshtml 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. @model Teknik.Areas.Help.ViewModels.HelpViewModel
  2. @Styles.Render("~/Content/help");
  3. <div class="container">
  4. <div class="row api">
  5. <h2><b>Teknik API</b></h2>
  6. <hr>
  7. <h3>Overview</h3>
  8. <p>
  9. The Teknik API is free for everyone to use, and is defined on a per service basis.
  10. <br />
  11. <br />
  12. The general API calls can be summarized as follows: <code>@Url.SubRouteUrl("api", "Api.Index", new { service = "<b>Service</b>", action = "<b>Action</b>", version = Model.Config.ApiConfig.Version })</code>
  13. </p>
  14. <h4>Responses</h4>
  15. <p>
  16. All responses are returned as json. The returned json can contain any of the following sections.
  17. <br />
  18. <br />
  19. <strong>Results</strong>
  20. <pre><code>{"results":{"&lt;resultType&gt;":{"&lt;resultData&gt;":"&lt;value&gt;"}}}</code></pre>
  21. <strong>Errors</strong>
  22. <pre><code>{"error":{"code":&lt;value&gt;, "message":"&lt;errorMessage&gt;"}}</code></pre>
  23. </p>
  24. <h3><b>Upload</b></h3>
  25. <hr>
  26. <p>This is a description of the API commands available for the Upload service.</p>
  27. <h4>Upload a File</h4>
  28. <pre><code>POST @Url.SubRouteUrl("api", "Api.Index", new { service = "Upload", action = "Post", version = Model.Config.ApiConfig.Version })</code></pre>
  29. <h5>Parameters</h5>
  30. <table>
  31. <thead>
  32. <tr>
  33. <th>Name</th>
  34. <th>Type</th>
  35. <th>Default</th>
  36. <th>Description</th>
  37. </tr>
  38. </thead>
  39. <tbody>
  40. <tr>
  41. <td>
  42. <code>file</code>
  43. </td>
  44. <td>
  45. <code>file</code>
  46. </td>
  47. <td>
  48. <var>NULL</var>
  49. </td>
  50. <td>
  51. <strong>Required</strong>
  52. The file that you would like to upload.
  53. </td>
  54. </tr>
  55. <tr>
  56. <td>
  57. <code>encrypt</code>
  58. </td>
  59. <td>
  60. <code>string</code>
  61. </td>
  62. <td>
  63. <var>no</var>
  64. </td>
  65. <td>
  66. If you want the file to be encrypted server side. This will regenerate the key and/or iv if none are passed in. Choose <code>yes</code> or <code>no</code>
  67. </td>
  68. </tr>
  69. <tr>
  70. <td>
  71. <code>key</code>
  72. </td>
  73. <td>
  74. <code>string</code>
  75. </td>
  76. <td>
  77. <var>NULL</var>
  78. </td>
  79. <td>
  80. If you want the file to be decrypted server side, include the key.
  81. </td>
  82. </tr>
  83. <tr>
  84. <td>
  85. <code>iv</code>
  86. </td>
  87. <td>
  88. <code>string</code>
  89. </td>
  90. <td>
  91. <var>NULL</var>
  92. </td>
  93. <td>
  94. If the file has been encrypted and you want it decrypted (Both Server and Client Side), include the iv.
  95. </td>
  96. </tr>
  97. <tr>
  98. <td>
  99. <code>getDeletionKey</code>
  100. </td>
  101. <td>
  102. <code>string</code>
  103. </td>
  104. <td>
  105. <var>no</var>
  106. </td>
  107. <td>
  108. Whether you would like to create a deletion link. Choose <code>yes</code> or <code>no</code>
  109. </td>
  110. </tr>
  111. </tbody>
  112. </table>
  113. <h5>Response</h5>
  114. <pre><code>{"results":{"file":{"name":"<var>fileName</var>", "url":"<var>url</var>", "type":"<var>file_type</var>", "size":<var>size</var>, "key":<var>key</var>, "iv":<var>iv</var>, "deletionKey":<var>deletionKey</var>}}}</code></pre>
  115. <table>
  116. <thead>
  117. <tr>
  118. <th>Name</th>
  119. <th>Type</th>
  120. <th>Description</th>
  121. </tr>
  122. </thead>
  123. <tbody>
  124. <tr>
  125. <td>
  126. <code>name</code>
  127. </td>
  128. <td>
  129. <code>string</code>
  130. </td>
  131. <td>
  132. The filename of the uploaded file.
  133. </td>
  134. </tr>
  135. <tr>
  136. <td>
  137. <code>url</code>
  138. </td>
  139. <td>
  140. <code>string</code>
  141. </td>
  142. <td>
  143. The direct url to the uploaded file. The key is apended to the url as an anchor tag.
  144. </td>
  145. </tr>
  146. <tr>
  147. <td>
  148. <code>type</code>
  149. </td>
  150. <td>
  151. <code>string</code>
  152. </td>
  153. <td>
  154. The MIME file type of the uploaded file.
  155. </td>
  156. </tr>
  157. <tr>
  158. <td>
  159. <code>size</code>
  160. </td>
  161. <td>
  162. <code>integer</code>
  163. </td>
  164. <td>
  165. The size of the uploaded file in bytes.
  166. </td>
  167. </tr>
  168. <tr>
  169. <td>
  170. <code>key</code>
  171. </td>
  172. <td>
  173. <code>string</code>
  174. </td>
  175. <td>
  176. The key that was used to encrypt the file.
  177. </td>
  178. </tr>
  179. <tr>
  180. <td>
  181. <code>iv</code>
  182. </td>
  183. <td>
  184. <code>string</code>
  185. </td>
  186. <td>
  187. The iv that was used to encrypt the file.
  188. </td>
  189. </tr>
  190. <tr>
  191. <td>
  192. <code>deletionKey</code>
  193. </td>
  194. <td>
  195. <code>string</code>
  196. </td>
  197. <td>
  198. <strong>Optional</strong>
  199. The deletion key for file. Use it as follows: <code>@Url.SubRouteUrl("u", "Upload.Upload", new { file = "<var>file.jpg</var>", key = "<var>deletionKey</var>" })</code>
  200. </td>
  201. </tr>
  202. </tbody>
  203. </table>
  204. <h5>Example</h5>
  205. <pre><code>$ curl -F "getDeletionKey=yes" -F "encrypt=yes" -F "file=@("@")image.png" @Url.SubRouteUrl("api", "Api.Index", new { service = "Upload", version = Model.Config.ApiConfig.Version })</code></pre>
  206. <br />
  207. <br />
  208. </div>
  209. </div>