Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2019
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 55.46 KB | None | 0 0
  1. FORMAT: 1A
  2. HOST: http://domain.com/api/v1
  3.  
  4. # E-Commerce Store
  5.  
  6. Online store API documentation.
  7.  
  8. *Notes: Use route alias `/:id` -> `/me` for self session*
  9.  
  10. ## Authorization [/login]
  11.  
  12. ### Login [PUT]
  13. + Request (application/json)
  14.  
  15. {"email": "email@gmail.com", "password": "somepass"}
  16.  
  17. + Response 200 (application/json)
  18.  
  19. {"jwtToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF..."}
  20.  
  21. + Response 400 (application/json)
  22.  
  23. {"type": "ERR_REQUEST", "code": 400, "message": "invalid email or password"}
  24.  
  25. ## Session [/me]
  26.  
  27. ### Self info [GET]
  28.  
  29. + Request
  30.  
  31. + Header
  32.  
  33. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  34.  
  35. + Response 200 (application/json)
  36.  
  37. + Body
  38.  
  39. {"email": "email@gmail.com", "id": "5b9aa078ff86ee00016c1f0d", "isGuest": false, "roleName": "User", "rolePriority": 1, "sessionId": "RPb0gHkSoZzijMj4VUZQ63zundzb3Z"}
  40.  
  41. ## User [/users]
  42.  
  43. ### Create user / Registration [POST /users]
  44.  
  45. + Request (application/json)
  46.  
  47. {"email": "somemail@gmail.com", "password": "12345678"}
  48.  
  49. + Response 200 (application/json)
  50.  
  51. + Body
  52.  
  53. {"jwtToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF..."}
  54.  
  55. + Response 400 (application/json)
  56.  
  57. + Body
  58. {
  59. "type": "ERR_VALID",
  60. "code": 400,
  61. "message": "Validation failed",
  62. "fields": [
  63. {
  64. "name": "Email",
  65. "rule": "required",
  66. "detail": "Field must not be empty"
  67. },
  68. {
  69. "name": "Password",
  70. "rule": "required",
  71. "detail": "Field must not be empty"
  72. }
  73. ],
  74. }
  75.  
  76. ### List all users [GET /users(?id,pageLimit,pageNumber,email)]
  77.  
  78.  
  79. + Parameters
  80. + pageLimit (optional, Number) ... items per page
  81. + pageNumber (optional, Number) ... page
  82. + email (optional, String) ... find by email
  83. + id (optional, String) ... find by id
  84.  
  85. + Request
  86.  
  87. + Header
  88.  
  89. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  90.  
  91. + Response 200 (application/json)
  92.  
  93. + Body
  94.  
  95. {"results": [{ "id": "5b9c0a23de101c00013677ef", "email": "admin@gmail.com", "password": "$2a$04$HKiZ//7GPG...", "createdAt": "2018-09-14T19:21:07.446Z", "updatedAt": "2018-09-14T19:21:07.446Z" }, { "id": "5b9c1238de101c0001367807", "email": "someuser@gmail.com", "password": "$2a$04$HKiZ//7GPG...", "createdAt": "2018-09-14T19:21:07.446Z", "updatedAt": "2018-09-14T19:21:07.446Z" } ], "total": 2 }
  96.  
  97. + Response 403 (application/json)
  98.  
  99. + Body
  100.  
  101. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  102.  
  103. ### Retrieve a user [GET /users/:id]
  104.  
  105. + Request
  106.  
  107. + Header
  108.  
  109. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  110.  
  111. + Response 200 (application/json)
  112.  
  113. + Body
  114.  
  115. { "id": "5b9c0a23de101c00013677ef", "email": "admin@gmail.com", "password": "$2a$04$HKiZ//7GPG...", "createdAt": "2018-09-14T19:21:07.446Z", "updatedAt": "2018-09-14T19:21:07.446Z" }
  116.  
  117. + Response 403 (application/json)
  118.  
  119. + Body
  120.  
  121. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  122.  
  123. + Response 404 (application/json)
  124.  
  125. + Body
  126.  
  127. { "type": "ERR_FOUND", "code": 404, "message": "User not found"}
  128.  
  129. ## User Orders [/users/:id/orders]
  130.  
  131. ### List all user orders [GET /users/:id/orders]
  132.  
  133. + Response 200 (application/json)
  134.  
  135. {
  136. "results": [
  137. {
  138. "id": "5bae1b6ea6128100012e79cc",
  139. "userId": "5b9c0bbede101c00013677f0",
  140. "status": 2,
  141. "receivedAt": "2018-09-28T21:13:08.559+07:00",
  142. "acceptedAt": "0001-01-01T00:00:00Z",
  143. "rejectedAt": "0001-01-01T00:00:00Z",
  144. "shippedAt": "0001-01-01T00:00:00Z",
  145. "items": [
  146. {
  147. "product": {
  148. "id": "5bae0a8cc1c3aa0001add65f",
  149. "category": {
  150. "id": "5bae05a92eee1300016b1dd7",
  151. "title": "Раздел 1",
  152. "url": "razdel-1",
  153. "createdAt": "0001-01-01T00:00:00Z",
  154. "updatedAt": "0001-01-01T00:00:00Z"
  155. },
  156. "image": {
  157. "gallery": [
  158. {
  159. "imageUrl": "/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"
  160. }
  161. ],
  162.  
  163. },
  164. "title": "Somename",
  165. "permalink": "somename",
  166. "sku": "AAA-BBB",
  167. "description": "full text",
  168. "shortDescription": "small text",
  169. "priceCurrency": "rub",
  170. "weight": 200,
  171. "weightUnit": "г",
  172. "commission": 10,
  173. "discount": 5,
  174. "price": 100,
  175. "priceRetail": 104.5,
  176. "available": true,
  177. "visible": true,
  178. "createdAt": "2018-09-28T18:03:40.689+07:00",
  179. "updatedAt": "2018-09-28T18:04:17.53+07:00"
  180. },
  181. "quantity": 2,
  182. "priceTotal": 200,
  183. "priceTotalRatail": 209
  184. }
  185. ],
  186. "itemsQuantityTotal": 2,
  187. "itemsTotal": 1,
  188. "priceCurrency": "rub",
  189. "priceTotal": 200,
  190. "priceTotalRatail": 209,
  191. "deliveryAddress": {
  192. "firstName": "Some",
  193. "lastName": "Name",
  194. "countryName": "Russia",
  195. "countryCode": "RU",
  196. "city": "Novosibirsk",
  197. "address": "Красный проспект 32",
  198. "postalCode": "2444-1122"
  199. },
  200. "createdAt": "2018-09-28T19:15:42.311+07:00",
  201. "updatedAt": "2018-09-28T21:13:08.559+07:00"
  202. }
  203. ],
  204. "total": 1
  205. }
  206.  
  207.  
  208. + Response 403 (application/json)
  209.  
  210. + Body
  211.  
  212. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  213.  
  214. ### Retrieve a user order [GET /users/:id/orders/:id]
  215.  
  216. + Request
  217.  
  218. + Header
  219.  
  220. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  221.  
  222. + Response 200 (application/json)
  223.  
  224. + Body
  225.  
  226. {
  227. "id": "5bae1b6ea6128100012e79cc",
  228. "userId": "5b9c0bbede101c00013677f0",
  229. "status": 2,
  230. "receivedAt": "2018-09-28T21:13:08.559+07:00",
  231. "acceptedAt": "0001-01-01T00:00:00Z",
  232. "rejectedAt": "0001-01-01T00:00:00Z",
  233. "shippedAt": "0001-01-01T00:00:00Z",
  234. "items": [
  235. {
  236. "product": {
  237. "id": "5bae0a8cc1c3aa0001add65f",
  238. "category": {
  239. "id": "5bae05a92eee1300016b1dd7",
  240. "title": "Раздел 1",
  241. "url": "razdel-1",
  242. "createdAt": "0001-01-01T00:00:00Z",
  243. "updatedAt": "0001-01-01T00:00:00Z"
  244. },
  245. "image": {
  246. "gallery": [
  247. {
  248. "imageUrl": "/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"
  249. }
  250. ],
  251.  
  252. },
  253. "title": "Somename",
  254. "permalink": "somename",
  255. "sku": "AAA-BBB",
  256. "description": "full text",
  257. "shortDescription": "small text",
  258. "priceCurrency": "rub",
  259. "weight": 200,
  260. "weightUnit": "г",
  261. "commission": 10,
  262. "discount": 5,
  263. "price": 100,
  264. "priceRetail": 104.5,
  265. "available": true,
  266. "visible": true,
  267. "createdAt": "2018-09-28T18:03:40.689+07:00",
  268. "updatedAt": "2018-09-28T18:04:17.53+07:00"
  269. },
  270. "quantity": 2,
  271. "priceTotal": 200,
  272. "priceTotalRatail": 209
  273. }
  274. ],
  275. "itemsQuantityTotal": 2,
  276. "itemsTotal": 1,
  277. "priceCurrency": "rub",
  278. "priceTotal": 200,
  279. "priceTotalRatail": 209,
  280. "deliveryAddress": {
  281. "firstName": "Some",
  282. "lastName": "Name",
  283. "countryName": "Russia",
  284. "countryCode": "RU",
  285. "city": "Novosibirsk",
  286. "address": "Красный проспект 32",
  287. "postalCode": "2444-1122"
  288. },
  289. "createdAt": "2018-09-28T19:15:42.311+07:00",
  290. "updatedAt": "2018-09-28T21:13:08.559+07:00"
  291. }
  292. + Response 403 (application/json)
  293.  
  294. + Body
  295.  
  296. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  297.  
  298. + Response 404 (application/json)
  299.  
  300. + Body
  301.  
  302. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  303.  
  304.  
  305. ## Tracking [/tracking]
  306.  
  307. ### Order [GET /tracking/orders/:orderNumber]
  308.  
  309. + Request
  310.  
  311. + Header
  312.  
  313. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  314.  
  315. + Response 200 (application/json)
  316.  
  317. + Body
  318.  
  319. {"order":{"id":"5bc4825e30df840001ddfdef","orderNumber":"DDFDEF","guestSessionId":"xxxx","status":2,"receivedAt":"2018-10-15T12:05:03.492Z","acceptedAt":"0001-01-01T00:00:00Z","rejectedAt":"0001-01-01T00:00:00Z","shippedAt":"0001-01-01T00:00:00Z","items":[{"product":{"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bc20cf576c4be000161032a","level":2,"title":"Субраздел 3","url":"subrazdel-3","createdAt":"2018-09-28T10:42:49.492Z","updatedAt":"2018-10-11T13:45:16.548Z"},"image":{"gallery":[{"imageUrl":"/upload/products/5bae0a8cc1c3aa0001add65f/3s55vmo11XV1IXmpb4raLu2IZPNRJK.jpg"}]},"attributes":[{"title":"a","description":"1"},{"title":"g","description":"h"},{"title":"c","description":"2"}],"title":"Корм для кошки Eukanuba сухой 100 грамм","permalink":"Korm-dlya-koshki-Eukanuba-suhoi-100-gramm","sku":"AAA-BBB","description":"-1","shortDescription":"small text","priceCurrency":"rub","weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T11:03:40.689Z","updatedAt":"2018-10-14T11:48:05.655Z"},"quantity":12,"priceTotal":1200,"priceTotalRatail":1254}],"itemsQuantityTotal":12,"itemsTotal":1,"priceCurrency":"rub","priceTotal":1200,"priceTotalRatail":1254,"deliveryAddress":{"firstName":"Petya","lastName":"Ivanov","countryName":"Russia","countryCode":"RU","city":"Новосибирск","address":"Красный проспект 32","postalCode":"90000","phone":"+7-999-999-99-99"},"createdAt":"2018-10-15T12:04:46.512Z","updatedAt":"2018-10-15T12:05:03.493Z"}}
  320.  
  321. + Response 403 (application/json)
  322.  
  323. + Body
  324.  
  325. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  326.  
  327. + Response 404 (application/json)
  328.  
  329. + Body
  330.  
  331. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  332.  
  333. ## Address [/users/:id/addresses]
  334.  
  335. ### List all addresses [GET]
  336.  
  337. + Request
  338.  
  339. + Header
  340.  
  341. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  342.  
  343. + Response 200 (application/json)
  344.  
  345. { "results": [{ "id": "5badfb7fa749ae00017fa5fe", "userId": "5b990765fac86500011dbacf", "firstName": "Petya", "lastName": "ivanov", "countryName": "Russian", "countryCode": "RU", "city": "Новосибирск", "address": "Красный проспект 32", "postalCode": "90000", "createdAt": "2018-09-28T09:59:27.708Z", "updatedAt": "2018-09-28T09:59:27.708Z" }, { "id": "5badfbb1a749ae00017fa600", "userId": "5b990765fac86500011dbacf", "firstName": "Petya", "lastName": "ivanov", "countryName": "Russian", "countryCode": "RU", "city": "Новосибирск", "address": "Красный проспект 32", "postalCode": "90000", "createdAt": "2018-09-28T10:00:17.243Z", "updatedAt": "2018-09-28T10:00:17.243Z" } ] }
  346.  
  347. + Response 403 (application/json)
  348.  
  349. + Body
  350.  
  351. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  352.  
  353. + Response 404 (application/json)
  354.  
  355. + Body
  356.  
  357. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  358.  
  359. ### Retrieve a address [GET /users/:id/addresses/:addr_id]
  360.  
  361. + Request
  362.  
  363. + Header
  364.  
  365. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  366.  
  367. + Response 200 (application/json)
  368.  
  369. + Body
  370.  
  371. {
  372. "id": "5badfb7fa749ae00017fa5fe",
  373. "userId": "5b990765fac86500011dbacf",
  374. "firstName": "Petya",
  375. "lastName": "ivanov",
  376. "countryName": "Russian",
  377. "countryCode": "RU",
  378. "city": "Новосибирск",
  379. "address": "Красный проспект 32",
  380. "postalCode": "90000",
  381. "createdAt": "2018-09-28T09:59:27.708Z",
  382. "updatedAt": "2018-09-28T09:59:27.708Z"
  383. }
  384. + Response 403 (application/json)
  385.  
  386. + Body
  387.  
  388. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  389.  
  390. + Response 404 (application/json)
  391.  
  392. + Body
  393.  
  394. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  395.  
  396.  
  397. ### Create address [POST /users/:id/addresses]
  398.  
  399. + Request
  400.  
  401.  
  402. + Header
  403.  
  404. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  405.  
  406. + Body
  407. {"type": "delivery", "firstName": "Petya", "lastName": "Ivanov", "city": "Новосибирск", "address": "Зеленая 32", "postalCode": "90000", "phone": "+7-999-999-99-99"}
  408.  
  409.  
  410. + Response 200 (application/json)
  411.  
  412. + Body
  413.  
  414. {"id": "5badff64a749ae00017fa602"}
  415.  
  416. + Response 400 (application/json)
  417.  
  418. + Body
  419. {"type":"ERR_VALID","code":400,"message":"Validation failed","fields":[{"name":"FirstName","rule":"required","detail":"Field must not be empty"},{"name":"LastName","rule":"required","detail":"Field must not be empty"},{"name":"City","rule":"required","detail":"Field must not be empty"},{"name":"Address","rule":"required","detail":"Field must not be empty"},{"name":"PostalCode","rule":"required","detail":"Field must not be empty"}]}
  420.  
  421. + Response 403 (application/json)
  422.  
  423. + Body
  424.  
  425. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  426.  
  427. + Response 404 (application/json)
  428.  
  429. + Body
  430.  
  431. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  432.  
  433. ### Update address [PUT /users/:id/addresses/:addr_id]
  434.  
  435. + Request
  436.  
  437. + Header
  438.  
  439. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  440.  
  441. + Body
  442. {"type": "delivery", "firstName": "Petya", "lastName": "Ivanov", "city": "Новосибирск", "address": "Зеленая 32", "postalCode": "90000", "phone": "+7-999-999-99-99"}
  443.  
  444.  
  445. + Response 200 (application/json)
  446.  
  447. + Body
  448.  
  449. {"id": "5badff64a749ae00017fa602"}
  450.  
  451. + Response 400 (application/json)
  452.  
  453. + Body
  454. {"type":"ERR_VALID","code":400,"message":"Validation failed","fields":[{"name":"FirstName","rule":"required","detail":"Field must not be empty"},{"name":"LastName","rule":"required","detail":"Field must not be empty"},{"name":"City","rule":"required","detail":"Field must not be empty"},{"name":"Address","rule":"required","detail":"Field must not be empty"},{"name":"PostalCode","rule":"required","detail":"Field must not be empty"}]}
  455.  
  456. + Response 403 (application/json)
  457.  
  458. + Body
  459.  
  460. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  461.  
  462. ### Delete address [DELETE /users/:id/addresses/:addr_id]
  463.  
  464. + Request
  465.  
  466. + Header
  467.  
  468. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  469.  
  470. + Response 200 (application/json)
  471.  
  472. + Body
  473.  
  474. null
  475.  
  476. + Response 403 (application/json)
  477.  
  478. + Body
  479.  
  480. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  481.  
  482. + Response 404 (application/json)
  483.  
  484. + Body
  485.  
  486. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  487.  
  488. ## Category [/categories]
  489.  
  490. ### List all categories [GET]
  491.  
  492.  
  493. + Response 200 (application/json)
  494.  
  495. [{"id":"5bae03fa2eee1300016b1dd1","title":"Раздел 1","url":"razdel-1","createdAt":"2018-09-28 10:35:38.396 +0000 UTC","updatedAt":"0001-01-01 00:00:00 +0000 UTC","children":[{"id":"5bae04072eee1300016b1dd3","level":1,"title":"Подраздел 1","url":"podrazdel-1","description":"текст","createdAt":"2018-09-28 10:35:51.175 +0000 UTC","updatedAt":"0001-01-01 00:00:00 +0000 UTC","children":[{"id":"5bae041b2eee1300016b1dd4","level":2,"title":"Подраздел 2","url":"podrazdel-2","createdAt":"2018-09-28 10:36:11.344 +0000 UTC","updatedAt":"0001-01-01 00:00:00 +0000 UTC"}]}]},{"id":"5bae03fe2eee1300016b1dd2","title":"Раздел 2","url":"razdel-2","createdAt":"2018-09-28 10:35:42.546 +0000 UTC","updatedAt":"0001-01-01 00:00:00 +0000 UTC"}]
  496.  
  497. ### Create Category [POST]
  498.  
  499. + Request
  500.  
  501.  
  502. + Header
  503.  
  504. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  505.  
  506. + Body
  507. {"title":"Раздел 1","url":"razdel-1", "description": "some text"}
  508.  
  509. + Response 200 (application/json)
  510.  
  511. + Body
  512.  
  513. {"id": "5bae05a92eee1300016b1dd7"}
  514.  
  515. + Response 400 (application/json)
  516.  
  517. + Body
  518. {"type":"ERR_VALID","code":400,"message":"Validation failed","fields":[{"name":"Title","rule":"required","detail":"Field must not be empty"},{"name":"Url","rule":"required","detail":"Field must not be empty"}]}
  519.  
  520. + Response 403 (application/json)
  521.  
  522. + Body
  523.  
  524. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  525.  
  526. ### Create Subcategory [POST /categories/:id]
  527.  
  528. + Request
  529.  
  530.  
  531. + Header
  532.  
  533. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  534.  
  535. + Body
  536.  
  537. {"title":"Подраздел 1","url":"podrazdel-1", "description": "some text 2"}
  538.  
  539. + Response 200 (application/json)
  540.  
  541. + Body
  542.  
  543. {"id": "5bae06612eee1300016b1dd8"}
  544.  
  545. + Response 400 (application/json)
  546.  
  547. + Body
  548. {"type":"ERR_VALID","code":400,"message":"Validation failed","fields":[{"name":"Title","rule":"required","detail":"Field must not be empty"},{"name":"Url","rule":"required","detail":"Field must not be empty"}]}
  549.  
  550. + Response 403 (application/json)
  551.  
  552. + Body
  553.  
  554. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  555.  
  556. + Response 404 (application/json)
  557.  
  558. + Body
  559.  
  560. {"type": "ERR_FOUND", "code": 404, "message": "Not found"}
  561.  
  562. ### Update Category [PUT /categories/:id]
  563.  
  564. + Request
  565.  
  566.  
  567. + Header
  568.  
  569. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  570.  
  571. + Body
  572.  
  573. {"title":"Подраздел 1","url":"podrazdel-1", "description": "some text 3"}
  574.  
  575. + Response 200 (application/json)
  576.  
  577. + Body
  578.  
  579. {"id": "5bae06612eee1300016b1dd8"}
  580.  
  581. + Response 400 (application/json)
  582.  
  583. + Body
  584. {"type":"ERR_VALID","code":400,"message":"Validation failed","fields":[{"name":"Title","rule":"required","detail":"Field must not be empty"},{"name":"Url","rule":"required","detail":"Field must not be empty"}]}
  585.  
  586. + Response 403 (application/json)
  587.  
  588. + Body
  589.  
  590. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  591.  
  592. + Response 404 (application/json)
  593.  
  594. + Body
  595.  
  596. {"type": "ERR_FOUND", "code": 404, "message": "Not found"}
  597.  
  598. ### Delete Category [DELETE /categories/:id]
  599.  
  600. + Request
  601.  
  602. + Header
  603.  
  604. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  605.  
  606. + Response 200 (application/json)
  607.  
  608. + Body
  609.  
  610. {"id": "5bae06612eee1300016b1dd8"}
  611.  
  612. + Response 403 (application/json)
  613.  
  614. + Body
  615.  
  616. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  617.  
  618. + Response 404 (application/json)
  619.  
  620. + Body
  621.  
  622. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  623.  
  624. ### Update Category Products [PUT /categories/:id/products]
  625.  
  626. + Request
  627.  
  628.  
  629. + Header
  630.  
  631. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  632.  
  633. + Body
  634. {"commission":10, "discount":1, "subcategory": true}
  635.  
  636. + Response 403 (application/json)
  637.  
  638. + Body
  639.  
  640. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  641.  
  642. + Response 200 (application/json)
  643.  
  644. + Body
  645.  
  646. {"count": 20}
  647.  
  648. ## Product [/products]
  649.  
  650. ### List all products [GET /products(?id,text,categoryId,sku,permalink,pageLimit,pageNumber)]
  651.  
  652.  
  653. + Parameters
  654. + id (optional, String) ... find by id
  655. + text (optional, String) ... search string
  656. + categoryId (optional, String) ... filter by categoryId
  657. + sku (optional, String) ... find by sku
  658. + permalink (optional, String) ... find by permalink
  659. + pageLimit (optional, Number) ... items per page
  660. + pageNumber (optional, Number) ... page
  661.  
  662.  
  663. + Response 200 (application/json)
  664.  
  665. {"results":[{"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"}]},"title":"Somename","permalink":"somename","sku":"AAA-BBB","description":"full text","shortDescription":"small text","priceCurrency":"rub","attributes": [{"title": "Производитель", "description": "Eukanuba"}],"weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T11:03:40.689Z","updatedAt":"2018-09-28T11:04:17.53Z"}],"total":1}
  666.  
  667. ### Retrieve a product [GET /products/:id]
  668.  
  669. + Request
  670.  
  671. + Header
  672.  
  673. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  674.  
  675. + Response 200 (application/json)
  676.  
  677. + Body
  678.  
  679. {"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"}]},"title":"Somename","permalink":"somename","sku":"AAA-BBB","description":"full text","shortDescription":"small text","priceCurrency":"rub","attributes": [{"title": "Производитель", "description": "Eukanuba"}],"weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T11:03:40.689Z","updatedAt":"2018-09-28T11:04:17.53Z"}
  680.  
  681. + Response 403 (application/json)
  682.  
  683. + Body
  684.  
  685. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  686.  
  687. + Response 404 (application/json)
  688.  
  689. + Body
  690.  
  691. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  692.  
  693. ### Create Product [POST]
  694.  
  695. + Request
  696.  
  697.  
  698. + Header
  699.  
  700. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  701.  
  702. + Body
  703.  
  704. {"commission":10,"category":{"id":"5bae05a92eee1300016b1dd7"}, "attributes": [{"title": "Производитель", "description": "Eukanuba"}], "title":"Some product title","permalink":"some-product-title","sku":"AA-BB-CC","weight":1.5,"weightUnit":"кг","price":2500.5,"discount":5,"shortDescription":"short title","description":"full title","available":true,"visible":true,"image":{"gallery":[{"imageUrl":"/upload/products/new/w02BwbBaypdrFPUVkPCVnovaMW4VqE.jpg"}]},"priceCurrency":"rub"}
  705.  
  706. + Response 200 (application/json)
  707.  
  708. + Body
  709.  
  710. {"id": "5bae0e8cc1c3aa0001add660"}
  711.  
  712. + Response 400 (application/json)
  713.  
  714. + Body
  715. {"type":"ERR_VALID","code":400,"message":"Validation failed","fields":[{"name":"Title","rule":"required","detail":"Field must not be empty"},{"name":"Permalink","rule":"required","detail":"Field must not be empty"}]}
  716.  
  717. + Response 403 (application/json)
  718.  
  719. + Body
  720.  
  721. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  722.  
  723. ### Update Product [PUT /products/:id]
  724.  
  725. + Request
  726.  
  727.  
  728. + Header
  729.  
  730. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  731.  
  732. + Body
  733.  
  734. {"commission":10,"category":{"id":"5bae05a92eee1300016b1dd7"}, "attributes": [{"title": "Производитель", "description": "Eukanuba"}], "title":"Some product title","permalink":"some-product-title","sku":"AA-BB-CC","weight":1.5,"weightUnit":"кг","price":2500.5,"discount":5,"shortDescription":"short title","description":"full title","available":true,"visible":true,"image":{"gallery":[{"imageUrl":"/upload/products/new/w02BwbBaypdrFPUVkPCVnovaMW4VqE.jpg"}]},"priceCurrency":"rub"}
  735.  
  736. + Response 200 (application/json)
  737.  
  738. + Body
  739.  
  740. {"id": "5bae06612eee1300016b1dd8"}
  741.  
  742. + Response 400 (application/json)
  743.  
  744. + Body
  745. {"type":"ERR_VALID","code":400,"message":"Validation failed","fields":[{"name":"Title","rule":"required","detail":"Field must not be empty"},{"name":"Permalink","rule":"required","detail":"Field must not be empty"}]}
  746.  
  747. + Response 403 (application/json)
  748.  
  749. + Body
  750.  
  751. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  752.  
  753. + Response 404 (application/json)
  754.  
  755. + Body
  756.  
  757. {"type": "ERR_FOUND", "code": 404, "message": "Not found"}
  758.  
  759. ### Delete Product [DELETE /products/:id]
  760.  
  761. + Request
  762.  
  763. + Header
  764.  
  765. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  766.  
  767. + Response 200 (application/json)
  768.  
  769. + Body
  770.  
  771. null
  772.  
  773. + Response 403 (application/json)
  774.  
  775. + Body
  776.  
  777. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  778.  
  779. + Response 404 (application/json)
  780.  
  781. + Body
  782.  
  783. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  784.  
  785. ## Cart [/cart]
  786.  
  787. ### Current Cart [GET]
  788.  
  789. + Request
  790.  
  791. + Header
  792.  
  793. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  794. Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
  795.  
  796. + Response 200 (application/json)
  797.  
  798. {"id":"5bae15a8a6128100012e79ca","userId":"5b9c0bbede101c00013677f0","status":1,"receivedAt":"0001-01-01T00:00:00Z","acceptedAt":"0001-01-01T00:00:00Z","rejectedAt":"0001-01-01T00:00:00Z","shippedAt":"0001-01-01T00:00:00Z","items":[{"product":{"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"}]},"title":"Somename","permalink":"somename","sku":"AAA-BBB","description":"full text","shortDescription":"small text","priceCurrency":"rub","weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T11:03:40.689Z","updatedAt":"2018-09-28T11:04:17.53Z"},"quantity":2,"priceTotal":200,"priceTotalRatail":209}],"itemsQuantityTotal":2,"itemsTotal":1,"priceCurrency":"rub","priceTotal":200,"priceTotalRatail":209,"createdAt":"2018-09-28T11:51:04.473Z","updatedAt":"2018-09-28T11:54:03.767Z"}
  799.  
  800. + Response 400 (application/json)
  801.  
  802. + Body
  803.  
  804. {"type":"ERR_REQUEST","code":400,"message":"Not found"}
  805.  
  806. + Response 403 (application/json)
  807.  
  808. + Body
  809. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  810.  
  811. ### Add Product [POST]
  812.  
  813. + Request
  814.  
  815.  
  816. + Header
  817.  
  818. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  819. Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
  820.  
  821. + Body
  822. {"productId": "5bae0a8cc1c3aa0001add65f", "quantity": 2}
  823.  
  824. + Response 201 (application/json)
  825.  
  826. + Body
  827.  
  828. {"id":"5bae15a8a6128100012e79ca","userId":"5b9c0bbede101c00013677f0","status":1,"receivedAt":"0001-01-01T00:00:00Z","acceptedAt":"0001-01-01T00:00:00Z","rejectedAt":"0001-01-01T00:00:00Z","shippedAt":"0001-01-01T00:00:00Z","items":[{"product":{"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"}]},"title":"Somename","permalink":"somename","sku":"AAA-BBB","description":"full text","shortDescription":"small text","priceCurrency":"rub","weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T11:03:40.689Z","updatedAt":"2018-09-28T11:04:17.53Z"},"quantity":2,"priceTotal":200,"priceTotalRatail":209}],"itemsQuantityTotal":2,"itemsTotal":1,"priceCurrency":"rub","priceTotal":200,"priceTotalRatail":209,"createdAt":"2018-09-28T11:51:04.473249458Z","updatedAt":"2018-09-28T11:51:04.482026616Z"}
  829.  
  830. + Response 400 (application/json)
  831.  
  832. + Body
  833.  
  834. {"type": "ERR_REQUEST", "code": 400, "message": "quantity required"}
  835.  
  836. + Response 403 (application/json)
  837.  
  838. + Body
  839. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  840.  
  841. ### Update Product [PUT]
  842.  
  843. + Request
  844.  
  845.  
  846. + Header
  847.  
  848. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  849. Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
  850.  
  851. + Body
  852. {"productId": "5bae0a8cc1c3aa0001add65f", "quantity": 10}
  853.  
  854. + Response 200 (application/json)
  855.  
  856. + Body
  857.  
  858. {"id":"5bae15a8a6128100012e79ca","userId":"5b9c0bbede101c00013677f0","status":1,"receivedAt":"0001-01-01T00:00:00Z","acceptedAt":"0001-01-01T00:00:00Z","rejectedAt":"0001-01-01T00:00:00Z","shippedAt":"0001-01-01T00:00:00Z","items":[{"product":{"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"}]},"title":"Somename","permalink":"somename","sku":"AAA-BBB","description":"full text","shortDescription":"small text","priceCurrency":"rub","weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T11:03:40.689Z","updatedAt":"2018-09-28T11:04:17.53Z"},"quantity":2,"priceTotal":200,"priceTotalRatail":209}],"itemsQuantityTotal":2,"itemsTotal":1,"priceCurrency":"rub","priceTotal":200,"priceTotalRatail":209,"createdAt":"2018-09-28T11:51:04.473249458Z","updatedAt":"2018-09-28T11:51:04.482026616Z"}
  859.  
  860. + Response 400 (application/json)
  861.  
  862. + Body
  863.  
  864. {"type": "ERR_REQUEST", "code": 400, "message": "quantity required"}
  865.  
  866. + Response 403 (application/json)
  867.  
  868. + Body
  869. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  870.  
  871. ### Delete Product [DELETE]
  872.  
  873. + Request
  874.  
  875. + Header
  876.  
  877. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  878. Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
  879. + Body
  880.  
  881. {"productId": "5bae0a8cc1c3aa0001add65f"}
  882.  
  883. + Response 200 (application/json)
  884.  
  885. + Body
  886.  
  887. {"id":"5bb381c344670e0001e10c81","userId":"5b9c0bbede101c00013677f0","status":1,"receivedAt":"0001-01-01T00:00:00Z","acceptedAt":"0001-01-01T00:00:00Z","rejectedAt":"0001-01-01T00:00:00Z","shippedAt":"0001-01-01T00:00:00Z","items":[{"product":{"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"}]},"title":"Somename","permalink":"somename","sku":"AAA-BBB","description":"full text","shortDescription":"small text","priceCurrency":"rub","weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T11:03:40.689Z","updatedAt":"2018-09-28T11:04:17.53Z"},"quantity":2,"priceTotal":200,"priceTotalRatail":209}],"itemsQuantityTotal":2,"itemsTotal":1,"priceCurrency":"rub","priceTotal":200,"priceTotalRatail":209,"createdAt":"2018-10-02T14:33:39.871Z","updatedAt":"2018-10-02T14:45:56.176Z"}
  888.  
  889. + Response 204 (application/json)
  890.  
  891. + Body
  892. null
  893.  
  894. + Response 404 (application/json)
  895.  
  896. + Body
  897.  
  898. { "type": "ERR_REQUEST", "code": 404, "message": "Not found" }
  899.  
  900. + Response 403 (application/json)
  901.  
  902. + Body
  903.  
  904. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  905.  
  906. ### Clear Cart [PATCH]
  907.  
  908. + Request
  909.  
  910. + Header
  911.  
  912. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  913. Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
  914.  
  915. + Response 200 (application/json)
  916.  
  917. + Body
  918.  
  919. null
  920.  
  921.  
  922. + Response 400 (application/json)
  923.  
  924. + Body
  925.  
  926. { "type": "ERR_REQUEST", "code": 400, "message": "Not found" }
  927.  
  928. + Response 403 (application/json)
  929.  
  930. + Body
  931.  
  932. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  933.  
  934. ### Confirm [POST /cart/confirm]
  935.  
  936.  
  937. * Confirm: Set both header Authorization & Session-Id for attach guest order to user
  938.  
  939. + Request
  940.  
  941. + Header
  942.  
  943. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  944. Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
  945.  
  946. + Body
  947.  
  948. {"customerNote": "Буду дома после 16:00", "deliveryAddress": {"firstName": "Petya", "lastName": "Ivanov", "city": "Новосибирск", "address": "Красный проспект 32", "postalCode": "90000", "phone": "+7-999-999-99-99"}}
  949.  
  950. + Response 200 (application/json)
  951.  
  952. + Body
  953.  
  954. {"id":"5bae3c30a19ea6715563a783"}
  955.  
  956.  
  957. + Response 400 (application/json)
  958.  
  959. + Body
  960.  
  961. {"type":"ERR_VALID","code":400,"message":"Validation failed","fields":[{"name":"DeliveryAddress","namespace":"Order.DeliveryAddress","rule":"required","detail":"Field must not be empty"}]}
  962.  
  963. + Response 403 (application/json)
  964.  
  965. + Body
  966.  
  967. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  968.  
  969. ## Order [/orders]
  970.  
  971. ### List all orders [GET /orders(?id,userId,guestSessionId,productId,productSku,status,pageNumber,pageLimit)]
  972.  
  973.  
  974. + Parameters
  975. + id (optional, String) ... find by id
  976. + userId (optional, String) ... filter by user
  977. + guestSessionId (optional, String) ... filter by guest session
  978. + productId (optional, String) ... filter by product
  979. + productSku (optional, String) ... filter by product sku
  980. + status (optional, String) ... filter by status
  981. + pageLimit (optional, Number) ... items per page
  982. + pageNumber (optional, Number) ... page
  983.  
  984.  
  985. + Response 200 (application/json)
  986.  
  987. {
  988. "results": [
  989. {
  990. "id": "5bae1b6ea6128100012e79cc",
  991. "userId": "5b9c0bbede101c00013677f0",
  992. "status": 2,
  993. "receivedAt": "2018-09-28T21:13:08.559+07:00",
  994. "acceptedAt": "0001-01-01T00:00:00Z",
  995. "rejectedAt": "0001-01-01T00:00:00Z",
  996. "shippedAt": "0001-01-01T00:00:00Z",
  997. "items": [
  998. {
  999. "product": {
  1000. "id": "5bae0a8cc1c3aa0001add65f",
  1001. "category": {
  1002. "id": "5bae05a92eee1300016b1dd7",
  1003. "title": "Раздел 1",
  1004. "url": "razdel-1",
  1005. "createdAt": "0001-01-01T00:00:00Z",
  1006. "updatedAt": "0001-01-01T00:00:00Z"
  1007. },
  1008. "image": {
  1009. "gallery": [
  1010. {
  1011. "imageUrl": "/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"
  1012. }
  1013. ],
  1014.  
  1015. },
  1016. "title": "Somename",
  1017. "permalink": "somename",
  1018. "sku": "AAA-BBB",
  1019. "description": "full text",
  1020. "shortDescription": "small text",
  1021. "priceCurrency": "rub",
  1022. "weight": 200,
  1023. "weightUnit": "г",
  1024. "commission": 10,
  1025. "discount": 5,
  1026. "price": 100,
  1027. "priceRetail": 104.5,
  1028. "available": true,
  1029. "visible": true,
  1030. "createdAt": "2018-09-28T18:03:40.689+07:00",
  1031. "updatedAt": "2018-09-28T18:04:17.53+07:00"
  1032. },
  1033. "quantity": 2,
  1034. "priceTotal": 200,
  1035. "priceTotalRatail": 209
  1036. }
  1037. ],
  1038. "itemsQuantityTotal": 2,
  1039. "itemsTotal": 1,
  1040. "priceCurrency": "rub",
  1041. "priceTotal": 200,
  1042. "priceTotalRatail": 209,
  1043. "deliveryAddress": {
  1044. "firstName": "Some",
  1045. "lastName": "Name",
  1046. "countryName": "Russia",
  1047. "countryCode": "RU",
  1048. "city": "Novosibirsk",
  1049. "address": "Красный проспект 32",
  1050. "postalCode": "2444-1122"
  1051. },
  1052. "createdAt": "2018-09-28T19:15:42.311+07:00",
  1053. "updatedAt": "2018-09-28T21:13:08.559+07:00"
  1054. }
  1055. ],
  1056. "total": 1
  1057. }
  1058.  
  1059. + Response 403 (application/json)
  1060.  
  1061. + Body
  1062.  
  1063. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1064.  
  1065. ### Retrieve a order [GET /orders/:id]
  1066.  
  1067. + Request
  1068.  
  1069. + Header
  1070.  
  1071. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1072.  
  1073. + Response 200 (application/json)
  1074.  
  1075. + Body
  1076.  
  1077. {
  1078. "id": "5bae1b6ea6128100012e79cc",
  1079. "userId": "5b9c0bbede101c00013677f0",
  1080. "status": 2,
  1081. "receivedAt": "2018-09-28T21:13:08.559+07:00",
  1082. "acceptedAt": "0001-01-01T00:00:00Z",
  1083. "rejectedAt": "0001-01-01T00:00:00Z",
  1084. "shippedAt": "0001-01-01T00:00:00Z",
  1085. "items": [
  1086. {
  1087. "product": {
  1088. "id": "5bae0a8cc1c3aa0001add65f",
  1089. "category": {
  1090. "id": "5bae05a92eee1300016b1dd7",
  1091. "title": "Раздел 1",
  1092. "url": "razdel-1",
  1093. "createdAt": "0001-01-01T00:00:00Z",
  1094. "updatedAt": "0001-01-01T00:00:00Z"
  1095. },
  1096. "image": {
  1097. "gallery": [
  1098. {
  1099. "imageUrl": "/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"
  1100. }
  1101. ],
  1102.  
  1103. },
  1104. "title": "Somename",
  1105. "permalink": "somename",
  1106. "sku": "AAA-BBB",
  1107. "description": "full text",
  1108. "shortDescription": "small text",
  1109. "priceCurrency": "rub",
  1110. "weight": 200,
  1111. "weightUnit": "г",
  1112. "commission": 10,
  1113. "discount": 5,
  1114. "price": 100,
  1115. "priceRetail": 104.5,
  1116. "available": true,
  1117. "visible": true,
  1118. "createdAt": "2018-09-28T18:03:40.689+07:00",
  1119. "updatedAt": "2018-09-28T18:04:17.53+07:00"
  1120. },
  1121. "quantity": 2,
  1122. "priceTotal": 200,
  1123. "priceTotalRatail": 209
  1124. }
  1125. ],
  1126. "itemsQuantityTotal": 2,
  1127. "itemsTotal": 1,
  1128. "priceCurrency": "rub",
  1129. "priceTotal": 200,
  1130. "priceTotalRatail": 209,
  1131. "deliveryAddress": {
  1132. "firstName": "Some",
  1133. "lastName": "Name",
  1134. "countryName": "Russia",
  1135. "countryCode": "RU",
  1136. "city": "Novosibirsk",
  1137. "address": "Красный проспект 32",
  1138. "postalCode": "2444-1122"
  1139. },
  1140. "createdAt": "2018-09-28T19:15:42.311+07:00",
  1141. "updatedAt": "2018-09-28T21:13:08.559+07:00"
  1142. }
  1143. + Response 403 (application/json)
  1144.  
  1145. + Body
  1146.  
  1147. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1148.  
  1149. + Response 404 (application/json)
  1150.  
  1151. + Body
  1152.  
  1153. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  1154.  
  1155. ### Update Order [PUT /orders/:id]
  1156.  
  1157. + Request
  1158.  
  1159.  
  1160. + Header
  1161.  
  1162. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1163.  
  1164. + Body
  1165.  
  1166. {"note": "some admin note", "deliveryAddress": {"firstName": "Ivan", "lastName": "Ivanov", "countryName": "Russia", "countryCode": "RU", "city": "Новосибирск", "address": "Красный проспект 99", "postalCode": "333-2323"}}
  1167.  
  1168. + Response 200 (application/json)
  1169.  
  1170. + Body
  1171.  
  1172. {"id": "5bae06612eee1300016b1dd8"}
  1173.  
  1174. + Response 403 (application/json)
  1175.  
  1176. + Body
  1177.  
  1178. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1179.  
  1180. + Response 404 (application/json)
  1181.  
  1182. + Body
  1183.  
  1184. {"type": "ERR_FOUND", "code": 404, "message": "Not found"}
  1185.  
  1186.  
  1187. ### Delete order [DELETE /orders/:id]
  1188.  
  1189. + Request
  1190.  
  1191. + Header
  1192.  
  1193. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1194.  
  1195. + Response 200 (application/json)
  1196.  
  1197. + Body
  1198.  
  1199. null
  1200.  
  1201.  
  1202. + Response 400 (application/json)
  1203.  
  1204. + Body
  1205.  
  1206. {"type":"ERR_REQUEST","code":400,"message":"Forbidden to delete for this status: Received"}
  1207.  
  1208. + Response 403 (application/json)
  1209.  
  1210. + Body
  1211.  
  1212. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1213.  
  1214. ### Add Product [POST /orders/:id/product]
  1215.  
  1216. + Request
  1217.  
  1218.  
  1219. + Header
  1220.  
  1221. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1222.  
  1223. + Body
  1224.  
  1225. {"productId": "5bae4798ad2a780001fc16fa", "quantity": 5}
  1226.  
  1227. + Response 200 (application/json)
  1228.  
  1229. + Body
  1230.  
  1231. {"id":"5bae1b6ea6128100012e79cc","userId":"5b9c0bbede101c00013677f0","status":2,"receivedAt":"2018-09-28T21:13:08.559+07:00","acceptedAt":"0001-01-01T00:00:00Z","rejectedAt":"0001-01-01T00:00:00Z","shippedAt":"0001-01-01T00:00:00Z","note":"some note","items":[{"product":{"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"}]},"title":"Somename","permalink":"somename","sku":"AAA-BBB","description":"full text","shortDescription":"small text","priceCurrency":"rub","weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T18:03:40.689+07:00","updatedAt":"2018-09-28T18:04:17.53+07:00"},"quantity":2,"priceTotal":200,"priceTotalRatail":209},{"product":{"id":"5bae4798ad2a780001fc16fa","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/5bae4798ad2a780001fc16fa/YZzZdKkQtIyKILmwUVLFL67Utn4wrO.jpg"}]},"title":"Some product 2","permalink":"some-product-2","sku":"AA-BBD","priceCurrency":"rub","weight":10.4,"weightUnit":"г","price":122,"priceRetail":122,"available":true,"visible":true,"createdAt":"2018-09-28T15:24:08.424Z","updatedAt":"2018-09-28T15:24:16.11Z"},"quantity":5,"priceTotal":610,"priceTotalRatail":610}],"itemsQuantityTotal":7,"itemsTotal":2,"priceCurrency":"rub","priceTotal":810,"priceTotalRatail":819,"deliveryAddress":{"firstName":"Ivan","lastName":"Ivanov","countryName":"Russia","countryCode":"RU","city":"NSK","address":"Красный проспект 99","postalCode":"123"},"createdAt":"2018-09-28T19:15:42.311+07:00","updatedAt":"2018-09-28T22:26:07.631944846+07:00"}
  1232.  
  1233. + Response 403 (application/json)
  1234.  
  1235. + Body
  1236.  
  1237. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1238.  
  1239. + Response 400 (application/json)
  1240.  
  1241. + Body
  1242.  
  1243. {"type": "ERR_REQUEST", "code": 400, "message": "Not found"}
  1244.  
  1245.  
  1246. ### Update Product [PUT /orders/:id/product]
  1247.  
  1248. + Request
  1249.  
  1250.  
  1251. + Header
  1252.  
  1253. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1254.  
  1255. + Body
  1256.  
  1257. {"productId": "5bae4798ad2a780001fc16fa", "quantity": 6}
  1258.  
  1259. + Response 200 (application/json)
  1260.  
  1261. + Body
  1262.  
  1263. {"id":"5bae1b6ea6128100012e79cc","userId":"5b9c0bbede101c00013677f0","status":2,"receivedAt":"2018-09-28T21:13:08.559+07:00","acceptedAt":"0001-01-01T00:00:00Z","rejectedAt":"0001-01-01T00:00:00Z","shippedAt":"0001-01-01T00:00:00Z","note":"some note","items":[{"product":{"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"}]},"title":"Somename","permalink":"somename","sku":"AAA-BBB","description":"full text","shortDescription":"small text","priceCurrency":"rub","weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T18:03:40.689+07:00","updatedAt":"2018-09-28T18:04:17.53+07:00"},"quantity":2,"priceTotal":200,"priceTotalRatail":209},{"product":{"id":"5bae4798ad2a780001fc16fa","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/5bae4798ad2a780001fc16fa/YZzZdKkQtIyKILmwUVLFL67Utn4wrO.jpg"}]},"title":"Some product 2","permalink":"some-product-2","sku":"AA-BBD","priceCurrency":"rub","weight":10.4,"weightUnit":"г","price":122,"priceRetail":122,"available":true,"visible":true,"createdAt":"2018-09-28T15:24:08.424Z","updatedAt":"2018-09-28T15:24:16.11Z"},"quantity":5,"priceTotal":610,"priceTotalRatail":610}],"itemsQuantityTotal":7,"itemsTotal":2,"priceCurrency":"rub","priceTotal":810,"priceTotalRatail":819,"deliveryAddress":{"firstName":"Ivan","lastName":"Ivanov","countryName":"Russia","countryCode":"RU","city":"NSK","address":"Красный проспект 99","postalCode":"123"},"createdAt":"2018-09-28T19:15:42.311+07:00","updatedAt":"2018-09-28T22:26:07.631944846+07:00"}
  1264.  
  1265. + Response 403 (application/json)
  1266.  
  1267. + Body
  1268.  
  1269. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1270.  
  1271. + Response 400 (application/json)
  1272.  
  1273. + Body
  1274.  
  1275. {"type": "ERR_REQUEST", "code": 400, "message": "Not found"}
  1276.  
  1277. ### Delete Product [DELETE /orders/:id/product]
  1278.  
  1279. + Request
  1280.  
  1281. + Header
  1282.  
  1283. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1284. + Body
  1285.  
  1286. {"productId": "5bae4798ad2a780001fc16fa"}
  1287.  
  1288. + Response 200 (application/json)
  1289.  
  1290. + Body
  1291.  
  1292. {"id":"5bae1b6ea6128100012e79cc","userId":"5b9c0bbede101c00013677f0","status":2,"receivedAt":"2018-09-28T21:13:08.559+07:00","acceptedAt":"0001-01-01T00:00:00Z","rejectedAt":"0001-01-01T00:00:00Z","shippedAt":"0001-01-01T00:00:00Z","note":"some note","items":[{"product":{"id":"5bae0a8cc1c3aa0001add65f","category":{"id":"5bae05a92eee1300016b1dd7","title":"Раздел 1","url":"razdel-1","createdAt":"0001-01-01T00:00:00Z","updatedAt":"0001-01-01T00:00:00Z"},"image":{"gallery":[{"imageUrl":"/upload/products/new/QR2lfbFbHqRIrrWZJtuaHyWuv4dpdZ.jpg"}]},"title":"Somename","permalink":"somename","sku":"AAA-BBB","description":"full text","shortDescription":"small text","priceCurrency":"rub","weight":200,"weightUnit":"г","commission":10,"discount":5,"price":100,"priceRetail":104.5,"available":true,"visible":true,"createdAt":"2018-09-28T18:03:40.689+07:00","updatedAt":"2018-09-28T18:04:17.53+07:00"},"quantity":2,"priceTotal":200,"priceTotalRatail":209}],"itemsQuantityTotal":2,"itemsTotal":1,"priceCurrency":"rub","priceTotal":200,"priceTotalRatail":209,"deliveryAddress":{"firstName":"Ivan","lastName":"Ivanov","countryName":"Russia","countryCode":"RU","city":"NSK","address":"Красный проспект 99","postalCode":"123"},"createdAt":"2018-09-28T19:15:42.311+07:00","updatedAt":"2018-09-28T22:31:24.405438179+07:00"}
  1293.  
  1294. + Response 403 (application/json)
  1295.  
  1296. + Body
  1297.  
  1298. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1299.  
  1300. + Response 404 (application/json)
  1301.  
  1302. + Body
  1303.  
  1304. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  1305.  
  1306. ### Accept Order [PATCH /orders/:id/accept]
  1307.  
  1308. + Request
  1309.  
  1310. + Header
  1311.  
  1312. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1313.  
  1314. + Response 200 (application/json)
  1315.  
  1316. + Body
  1317.  
  1318. {"id":"5bae1b6ea6128100012e79cc"}
  1319.  
  1320. + Response 400 (application/json)
  1321.  
  1322. + Body
  1323.  
  1324. {"type":"ERR_REQUEST","code":400,"message":"can not assign this status. rejected from RECEIVED to ACCEPTED"}
  1325.  
  1326.  
  1327. + Response 403 (application/json)
  1328.  
  1329. + Body
  1330.  
  1331. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1332.  
  1333. + Response 404 (application/json)
  1334.  
  1335. + Body
  1336.  
  1337. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  1338.  
  1339.  
  1340.  
  1341. ### Reject Order [PATCH /orders/:id/reject]
  1342.  
  1343. + Request
  1344.  
  1345. + Header
  1346.  
  1347. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1348.  
  1349. + Body
  1350.  
  1351. {"rejectReason": "Some reason text"}
  1352.  
  1353. + Response 200 (application/json)
  1354.  
  1355. + Body
  1356.  
  1357. {"id":"5bae1b6ea6128100012e79cc"}
  1358.  
  1359. + Response 400 (application/json)
  1360.  
  1361. + Body
  1362.  
  1363. {"type":"ERR_REQUEST","code":400,"message":"can not assign this status. rejected from RECEIVED to REJECTED"}
  1364.  
  1365.  
  1366. + Response 403 (application/json)
  1367.  
  1368. + Body
  1369.  
  1370. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1371.  
  1372. + Response 404 (application/json)
  1373.  
  1374. + Body
  1375.  
  1376. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  1377.  
  1378. ### Shipped Order [PATCH /orders/:id/shipped]
  1379.  
  1380. + Request
  1381.  
  1382. + Header
  1383.  
  1384. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1385.  
  1386. + Response 200 (application/json)
  1387.  
  1388. + Body
  1389.  
  1390. {"id":"5bae1b6ea6128100012e79cc"}
  1391.  
  1392. + Response 400 (application/json)
  1393.  
  1394. + Body
  1395.  
  1396. {"type": "ERR_REQUEST", "code": 400, "message": "can not assign this status. rejected from ACCEPTED to SHIPPED"}
  1397.  
  1398. + Response 403 (application/json)
  1399.  
  1400. + Body
  1401.  
  1402. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1403.  
  1404. + Response 404 (application/json)
  1405.  
  1406. + Body
  1407.  
  1408. { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
  1409.  
  1410. ## Gallery [/upload]
  1411.  
  1412. ### Upload [POST /upload/:object_name/:object_id]
  1413. + Request (application/json)
  1414. + Header
  1415.  
  1416. Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
  1417. + Body
  1418.  
  1419. {"files": ["multipart/data"]}
  1420.  
  1421. + Response 200 (application/json)
  1422. + Body
  1423. ["/upload/products/5bae4798ad2a780001fc16fa/icBI21wW4TiMDPFFgc0jIxuFIsGfGL.jpg"]
  1424.  
  1425. + Response 400 (application/json)
  1426.  
  1427. + Body
  1428.  
  1429. {"type":"ERR_REQUEST","code":400,"message":"Upload file is not a valid image"}
  1430.  
  1431. + Response 403 (application/json)
  1432.  
  1433. + Body
  1434.  
  1435. {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
  1436.  
  1437. ### Image Resize [GET /upload/:object_name/:object_id/:path(?w,h)]
  1438.  
  1439. + Parameters
  1440. + w (optional, Number) ... resize image width
  1441. + h (optional, Number) ... resize image height
  1442.  
  1443. + Response 200 (image/jpg)
  1444. + Response 404
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement