Advertisement
Guest User

Untitled

a guest
Dec 1st, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.76 KB | None | 0 0
  1.  
  2. <!doctype html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>API</title>
  7. <link rel="stylesheet" type="text/css" href="/stylesheets/style_new.css">
  8. <link rel="stylesheet" type="text/css"
  9. href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.9.0/github-markdown.min.css">
  10.  
  11. <meta name="description" content="API of this service">
  12. <meta name="author" content="Danil Kazimirov">
  13. <meta name="viewport" content="width=device-width, initial-scale=1">
  14. </head>
  15. <body>
  16. <header class="publication-header">
  17. <div class="header-title">
  18. <p>API</p>
  19. </div>
  20. </header>
  21. <div class="shadow-box-out">
  22. <div class="content-text publication-info">
  23. <div class="reset markdown-body">
  24. <h1>0. Errors</h1>
  25. <ul>
  26. <li>If your request is bad, you will get next</li>
  27. </ul>
  28. <h3>response:</h3>
  29. <pre><code>{
  30. success:false,
  31. message:String
  32. }
  33. </code></pre>
  34. <h1>1. Auth</h1>
  35. <ul>
  36. <li>
  37. <h1><strong>Login</strong></h1>
  38. </li>
  39. </ul>
  40. <p><code>post(/api/v1/auth/login)</code></p>
  41. <h3>request:</h3>
  42. <pre><code>{
  43. email:String,
  44. password:String
  45. }
  46. </code></pre>
  47. <h3>response:</h3>
  48. <pre><code>{
  49. success:true,
  50. email:String,
  51. tokens:
  52. [
  53. access:String,
  54. refresh:String
  55. ]
  56. }
  57. </code></pre>
  58. <ul>
  59. <li>
  60. <h1><strong>Register</strong></h1>
  61. </li>
  62. </ul>
  63. <p><code>post(/api/v1/auth/register)</code></p>
  64. <h3>request:</h3>
  65. <pre><code>{
  66. email:String,
  67. password:String,
  68. fullname:String,
  69. telegram{optional}:String
  70. }
  71. </code></pre>
  72. <h3>response:</h3>
  73. <pre><code>{
  74. success:true,
  75. tokens:
  76. [
  77. access:String,
  78. refresh:String
  79. ]
  80. }
  81. </code></pre>
  82. <ul>
  83. <li>
  84. <h1><strong>Logout</strong></h1>
  85. </li>
  86. </ul>
  87. <p><code>post(/api/v1/auth/logout)</code></p>
  88. <h3>request:</h3>
  89. <pre><code>{
  90. {SEND BEARER AUTHORIZATION HEADER}
  91. }
  92. </code></pre>
  93. <h3>response:</h3>
  94. <pre><code>{
  95. success:true,
  96. }
  97. </code></pre>
  98. <ul>
  99. <li>
  100. <h1><strong>Get new access token</strong></h1>
  101. </li>
  102. </ul>
  103. <p><code>post(/api/v1/auth/token)</code></p>
  104. <h3>request:</h3>
  105. <pre><code>{
  106. {SEND BEARER AUTHORIZATION HEADER}
  107. }
  108. </code></pre>
  109. <h3>response:</h3>
  110. <pre><code>{
  111. success:true,
  112. tokens:String
  113. }
  114. </code></pre>
  115. <h2>2. Publications</h2>
  116. <ul>
  117. <li>
  118. <h1><strong>Search</strong></h1>
  119. </li>
  120. </ul>
  121. <p><code>get(/api/v1/publications)</code></p>
  122. <p>request (use URL-encoded request):</p>
  123. <pre><code>page:Number(&gt;0) (optinal)
  124. limit:Number(&gt;0) (optinal)
  125. title:String (optinal)
  126. author:String (optinal)
  127. tags:[&quot;String&quot;] (optinal)
  128. id:String (optinal)
  129. </code></pre>
  130. <h3>response:</h3>
  131. <pre><code>{
  132. success:true,
  133. query:String [computed search query],
  134. page: Number,
  135. total: Number,
  136. limit: Number,
  137. pager: Number,
  138. items:
  139. [
  140. {
  141. title: String,
  142. author_id: String,
  143. image_id: String,
  144. text: String,
  145. description: String,
  146. id: String,
  147. createdAt: String,
  148. tags: [String],
  149. difficult: Number
  150. }
  151. ]
  152. }
  153. </code></pre>
  154. <ul>
  155. <li>
  156. <h1><strong>Delete</strong></h1>
  157. </li>
  158. </ul>
  159. <p><code>delete(/api/v1/publications)</code></p>
  160. <h3>request:</h3>
  161. <pre><code>{
  162. id:String
  163. }
  164. </code></pre>
  165. <h3>response:</h3>
  166. <pre><code>{
  167. success:true,
  168. query:String [computed search query],
  169. publication:
  170. {
  171. title: String,
  172. author_id: String,
  173. image_id: String,
  174. text: String,
  175. description: String,
  176. id: String,
  177. createdAt: String,
  178. tags: [String],
  179. difficult: Number
  180. }
  181. }
  182. </code></pre>
  183. <ul>
  184. <li>
  185. <h1><strong>Update</strong></h1>
  186. </li>
  187. </ul>
  188. <p><code>put(/api/v1/publications)</code></p>
  189. <h3>request:</h3>
  190. <pre><code> {
  191. target:String,
  192. title:String,
  193. description:String,
  194. text:String,
  195. difficult:Number,
  196. add_tags:[String] [list of new tags],
  197. remvoe_tags:[String] [list of tags to remove]
  198. image_id:String
  199. }
  200. </code></pre>
  201. <h3>response:</h3>
  202. <pre><code>eq. Publication.delete
  203. </code></pre>
  204. <ul>
  205. <li>
  206. <h1><strong>Create</strong></h1>
  207. </li>
  208. </ul>
  209. <p><code>post(/api/v1/publications)</code></p>
  210. <h3>request:</h3>
  211. <pre><code> {
  212. title:String,
  213. description:String,
  214. text:String,
  215. difficult:Number,
  216. tags:[String],
  217. image_id:String
  218. }
  219. </code></pre>
  220. <h3>response:</h3>
  221. <pre><code>{
  222. success:true,
  223. publication:
  224. {
  225. title: String,
  226. author_id: String,
  227. image_id: String,
  228. text: String,
  229. description: String,
  230. id: String,
  231. createdAt: String,
  232. tags: [String],
  233. difficult: Number
  234. }
  235. }
  236. </code></pre>
  237. <h2>2. Users</h2>
  238. <ul>
  239. <li>
  240. <h1><strong>Search</strong></h1>
  241. </li>
  242. </ul>
  243. <p><code>get(/api/v1/users)</code></p>
  244. <p>request (use URL-encoded request):</p>
  245. <pre><code>page:Number(&gt;0) (optinal)
  246. limit:Number(&gt;0) (optinal)
  247. fullname:String (optinal)
  248. email:String (optinal)
  249. publications:[&quot;String&quot;] (optinal)
  250. id:String (optinal)
  251. isAdmin:Boolean (optinal)
  252. telegram:String (optinal)
  253. </code></pre>
  254. <h3>response:</h3>
  255. <pre><code>{
  256. success:true,
  257. query:String [computed search query],
  258. page: Number,
  259. total: Number,
  260. limit: Number,
  261. pager: Number,
  262. items:
  263. [
  264. {
  265. fullname: String,
  266. telegram: String,
  267. email: String,
  268. isAdmun: Boolean,
  269. publicaitons: [String],
  270. id: String
  271. }
  272. ]
  273. }
  274. </code></pre>
  275. <ul>
  276. <li>
  277. <h1><strong>Delete</strong></h1>
  278. </li>
  279. </ul>
  280. <p><code>delete(/api/v1/users)</code></p>
  281. <h3>request:</h3>
  282. <pre><code>{
  283. id:String
  284. }
  285. </code></pre>
  286. <h3>response:</h3>
  287. <pre><code>{
  288. success:true,
  289. query:String [computed search query],
  290. user:
  291. {
  292. fullname: String,
  293. telegram: String,
  294. email: String,
  295. isAdmun: Boolean,
  296. publicaitons: [String],
  297. id: String
  298. }
  299. }
  300. </code></pre>
  301. <ul>
  302. <li>
  303. <h1><strong>Update</strong></h1>
  304. </li>
  305. </ul>
  306. <p><code>put(/api/v1/users)</code></p>
  307. <h3>request:</h3>
  308. <pre><code> {
  309. target:String,
  310. fullname:String (optinal)
  311. email:String (optinal
  312. password:String (optional)
  313. id:String (optinal)
  314. isAdmin:Boolean (optinal)
  315. telegram:String (optinal)
  316. }
  317. </code></pre>
  318. <h3>response:</h3>
  319. <pre><code>eq. Users.delete
  320. </code></pre>
  321. <h2>3. Resources</h2>
  322. <ul>
  323. <li>
  324. <h1><strong>Get</strong></h1>
  325. </li>
  326. </ul>
  327. <p><code>get(/api/v1/res)</code></p>
  328. <p>request (use URL-encoded request):</p>
  329. <pre><code>id:String
  330. </code></pre>
  331. <p>response:</p>
  332. <pre><code>file-data
  333. </code></pre>
  334. <ul>
  335. <li>
  336. <h1><strong>Delete</strong></h1>
  337. </li>
  338. </ul>
  339. <p><code>delete(/api/v1/res)</code></p>
  340. <h3>request:</h3>
  341. <pre><code> {
  342. id:String
  343. }
  344. </code></pre>
  345. <h3>response:</h3>
  346. <pre><code> {
  347. success:true,
  348. id: String
  349. }
  350. </code></pre>
  351. <ul>
  352. <li>
  353. <h1><strong>Create</strong></h1>
  354. </li>
  355. </ul>
  356. <p><code>post(/api/v1/res)</code></p>
  357. <h3>request:</h3>
  358. <pre><code>[use form-data header]
  359. {
  360. file:File
  361. }
  362. </code></pre>
  363. <h3>response:</h3>
  364. <pre><code>{
  365. success:true,
  366. id:String
  367. }
  368. </code></pre>
  369.  
  370. </div>
  371. </div>
  372. </div>
  373. <footer>
  374. <div class="light">
  375. <p>Developer: <em>Danil Kazimirov</em>, KPI student, <b>FAM</b><br>
  376. Contact me by <a href="https://telegram.me/ZulusK"
  377. target="_blank">telegram</a>
  378. </p>
  379. </div>
  380. </footer>
  381. </body>
  382. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement