Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FORMAT: 1A
- HOST: http://domain.com/api/v1
- # E-Commerce Store
- Online store API documentation.
- *Notes: Use route alias `/:id` -> `/me` for self session*
- ## Authorization [/login]
- ### Login [PUT]
- + Request (application/json)
- {"email": "email@gmail.com", "password": "somepass"}
- + Response 200 (application/json)
- {"jwtToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF..."}
- + Response 400 (application/json)
- {"type": "ERR_REQUEST", "code": 400, "message": "invalid email or password"}
- ## Session [/me]
- ### Self info [GET]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {"email": "email@gmail.com", "id": "5b9aa078ff86ee00016c1f0d", "isGuest": false, "roleName": "User", "rolePriority": 1, "sessionId": "RPb0gHkSoZzijMj4VUZQ63zundzb3Z"}
- ## User [/users]
- ### Create user / Registration [POST /users]
- + Request (application/json)
- {"email": "somemail@gmail.com", "password": "12345678"}
- + Response 200 (application/json)
- + Body
- {"jwtToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF..."}
- + Response 400 (application/json)
- + Body
- {
- "type": "ERR_VALID",
- "code": 400,
- "message": "Validation failed",
- "fields": [
- {
- "name": "Email",
- "rule": "required",
- "detail": "Field must not be empty"
- },
- {
- "name": "Password",
- "rule": "required",
- "detail": "Field must not be empty"
- }
- ],
- }
- ### List all users [GET /users(?id,pageLimit,pageNumber,email)]
- + Parameters
- + pageLimit (optional, Number) ... items per page
- + pageNumber (optional, Number) ... page
- + email (optional, String) ... find by email
- + id (optional, String) ... find by id
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {"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 }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Retrieve a user [GET /users/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- { "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" }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "User not found"}
- ## User Orders [/users/:id/orders]
- ### List all user orders [GET /users/:id/orders]
- + Response 200 (application/json)
- {
- "results": [
- {
- "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",
- "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": "Some",
- "lastName": "Name",
- "countryName": "Russia",
- "countryCode": "RU",
- "city": "Novosibirsk",
- "address": "Красный проспект 32",
- "postalCode": "2444-1122"
- },
- "createdAt": "2018-09-28T19:15:42.311+07:00",
- "updatedAt": "2018-09-28T21:13:08.559+07:00"
- }
- ],
- "total": 1
- }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Retrieve a user order [GET /users/:id/orders/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {
- "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",
- "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": "Some",
- "lastName": "Name",
- "countryName": "Russia",
- "countryCode": "RU",
- "city": "Novosibirsk",
- "address": "Красный проспект 32",
- "postalCode": "2444-1122"
- },
- "createdAt": "2018-09-28T19:15:42.311+07:00",
- "updatedAt": "2018-09-28T21:13:08.559+07:00"
- }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ## Tracking [/tracking]
- ### Order [GET /tracking/orders/:orderNumber]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {"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"}}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ## Address [/users/:id/addresses]
- ### List all addresses [GET]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- { "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" } ] }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Retrieve a address [GET /users/:id/addresses/:addr_id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {
- "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"
- }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Create address [POST /users/:id/addresses]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"type": "delivery", "firstName": "Petya", "lastName": "Ivanov", "city": "Новосибирск", "address": "Зеленая 32", "postalCode": "90000", "phone": "+7-999-999-99-99"}
- + Response 200 (application/json)
- + Body
- {"id": "5badff64a749ae00017fa602"}
- + Response 400 (application/json)
- + Body
- {"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"}]}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Update address [PUT /users/:id/addresses/:addr_id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"type": "delivery", "firstName": "Petya", "lastName": "Ivanov", "city": "Новосибирск", "address": "Зеленая 32", "postalCode": "90000", "phone": "+7-999-999-99-99"}
- + Response 200 (application/json)
- + Body
- {"id": "5badff64a749ae00017fa602"}
- + Response 400 (application/json)
- + Body
- {"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"}]}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Delete address [DELETE /users/:id/addresses/:addr_id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- null
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ## Category [/categories]
- ### List all categories [GET]
- + Response 200 (application/json)
- [{"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"}]
- ### Create Category [POST]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"title":"Раздел 1","url":"razdel-1", "description": "some text"}
- + Response 200 (application/json)
- + Body
- {"id": "5bae05a92eee1300016b1dd7"}
- + Response 400 (application/json)
- + Body
- {"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"}]}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Create Subcategory [POST /categories/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"title":"Подраздел 1","url":"podrazdel-1", "description": "some text 2"}
- + Response 200 (application/json)
- + Body
- {"id": "5bae06612eee1300016b1dd8"}
- + Response 400 (application/json)
- + Body
- {"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"}]}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- {"type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Update Category [PUT /categories/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"title":"Подраздел 1","url":"podrazdel-1", "description": "some text 3"}
- + Response 200 (application/json)
- + Body
- {"id": "5bae06612eee1300016b1dd8"}
- + Response 400 (application/json)
- + Body
- {"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"}]}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- {"type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Delete Category [DELETE /categories/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {"id": "5bae06612eee1300016b1dd8"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Update Category Products [PUT /categories/:id/products]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"commission":10, "discount":1, "subcategory": true}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 200 (application/json)
- + Body
- {"count": 20}
- ## Product [/products]
- ### List all products [GET /products(?id,text,categoryId,sku,permalink,pageLimit,pageNumber)]
- + Parameters
- + id (optional, String) ... find by id
- + text (optional, String) ... search string
- + categoryId (optional, String) ... filter by categoryId
- + sku (optional, String) ... find by sku
- + permalink (optional, String) ... find by permalink
- + pageLimit (optional, Number) ... items per page
- + pageNumber (optional, Number) ... page
- + Response 200 (application/json)
- {"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}
- ### Retrieve a product [GET /products/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {"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"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Create Product [POST]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"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"}
- + Response 200 (application/json)
- + Body
- {"id": "5bae0e8cc1c3aa0001add660"}
- + Response 400 (application/json)
- + Body
- {"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"}]}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Update Product [PUT /products/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"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"}
- + Response 200 (application/json)
- + Body
- {"id": "5bae06612eee1300016b1dd8"}
- + Response 400 (application/json)
- + Body
- {"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"}]}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- {"type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Delete Product [DELETE /products/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- null
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ## Cart [/cart]
- ### Current Cart [GET]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
- + Response 200 (application/json)
- {"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"}
- + Response 400 (application/json)
- + Body
- {"type":"ERR_REQUEST","code":400,"message":"Not found"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Add Product [POST]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
- + Body
- {"productId": "5bae0a8cc1c3aa0001add65f", "quantity": 2}
- + Response 201 (application/json)
- + Body
- {"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"}
- + Response 400 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 400, "message": "quantity required"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Update Product [PUT]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
- + Body
- {"productId": "5bae0a8cc1c3aa0001add65f", "quantity": 10}
- + Response 200 (application/json)
- + Body
- {"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"}
- + Response 400 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 400, "message": "quantity required"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Delete Product [DELETE]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
- + Body
- {"productId": "5bae0a8cc1c3aa0001add65f"}
- + Response 200 (application/json)
- + Body
- {"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"}
- + Response 204 (application/json)
- + Body
- null
- + Response 404 (application/json)
- + Body
- { "type": "ERR_REQUEST", "code": 404, "message": "Not found" }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Clear Cart [PATCH]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
- + Response 200 (application/json)
- + Body
- null
- + Response 400 (application/json)
- + Body
- { "type": "ERR_REQUEST", "code": 400, "message": "Not found" }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Confirm [POST /cart/confirm]
- * Confirm: Set both header Authorization & Session-Id for attach guest order to user
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- Session-Id: fk3fjwkro3jfoemv... (if is guest, you must get session id from the route /me)
- + Body
- {"customerNote": "Буду дома после 16:00", "deliveryAddress": {"firstName": "Petya", "lastName": "Ivanov", "city": "Новосибирск", "address": "Красный проспект 32", "postalCode": "90000", "phone": "+7-999-999-99-99"}}
- + Response 200 (application/json)
- + Body
- {"id":"5bae3c30a19ea6715563a783"}
- + Response 400 (application/json)
- + Body
- {"type":"ERR_VALID","code":400,"message":"Validation failed","fields":[{"name":"DeliveryAddress","namespace":"Order.DeliveryAddress","rule":"required","detail":"Field must not be empty"}]}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ## Order [/orders]
- ### List all orders [GET /orders(?id,userId,guestSessionId,productId,productSku,status,pageNumber,pageLimit)]
- + Parameters
- + id (optional, String) ... find by id
- + userId (optional, String) ... filter by user
- + guestSessionId (optional, String) ... filter by guest session
- + productId (optional, String) ... filter by product
- + productSku (optional, String) ... filter by product sku
- + status (optional, String) ... filter by status
- + pageLimit (optional, Number) ... items per page
- + pageNumber (optional, Number) ... page
- + Response 200 (application/json)
- {
- "results": [
- {
- "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",
- "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": "Some",
- "lastName": "Name",
- "countryName": "Russia",
- "countryCode": "RU",
- "city": "Novosibirsk",
- "address": "Красный проспект 32",
- "postalCode": "2444-1122"
- },
- "createdAt": "2018-09-28T19:15:42.311+07:00",
- "updatedAt": "2018-09-28T21:13:08.559+07:00"
- }
- ],
- "total": 1
- }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Retrieve a order [GET /orders/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {
- "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",
- "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": "Some",
- "lastName": "Name",
- "countryName": "Russia",
- "countryCode": "RU",
- "city": "Novosibirsk",
- "address": "Красный проспект 32",
- "postalCode": "2444-1122"
- },
- "createdAt": "2018-09-28T19:15:42.311+07:00",
- "updatedAt": "2018-09-28T21:13:08.559+07:00"
- }
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Update Order [PUT /orders/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"note": "some admin note", "deliveryAddress": {"firstName": "Ivan", "lastName": "Ivanov", "countryName": "Russia", "countryCode": "RU", "city": "Новосибирск", "address": "Красный проспект 99", "postalCode": "333-2323"}}
- + Response 200 (application/json)
- + Body
- {"id": "5bae06612eee1300016b1dd8"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- {"type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Delete order [DELETE /orders/:id]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- null
- + Response 400 (application/json)
- + Body
- {"type":"ERR_REQUEST","code":400,"message":"Forbidden to delete for this status: Received"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Add Product [POST /orders/:id/product]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"productId": "5bae4798ad2a780001fc16fa", "quantity": 5}
- + Response 200 (application/json)
- + Body
- {"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"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 400 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 400, "message": "Not found"}
- ### Update Product [PUT /orders/:id/product]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"productId": "5bae4798ad2a780001fc16fa", "quantity": 6}
- + Response 200 (application/json)
- + Body
- {"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"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 400 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 400, "message": "Not found"}
- ### Delete Product [DELETE /orders/:id/product]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"productId": "5bae4798ad2a780001fc16fa"}
- + Response 200 (application/json)
- + Body
- {"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"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Accept Order [PATCH /orders/:id/accept]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {"id":"5bae1b6ea6128100012e79cc"}
- + Response 400 (application/json)
- + Body
- {"type":"ERR_REQUEST","code":400,"message":"can not assign this status. rejected from RECEIVED to ACCEPTED"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Reject Order [PATCH /orders/:id/reject]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"rejectReason": "Some reason text"}
- + Response 200 (application/json)
- + Body
- {"id":"5bae1b6ea6128100012e79cc"}
- + Response 400 (application/json)
- + Body
- {"type":"ERR_REQUEST","code":400,"message":"can not assign this status. rejected from RECEIVED to REJECTED"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ### Shipped Order [PATCH /orders/:id/shipped]
- + Request
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Response 200 (application/json)
- + Body
- {"id":"5bae1b6ea6128100012e79cc"}
- + Response 400 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 400, "message": "can not assign this status. rejected from ACCEPTED to SHIPPED"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- + Response 404 (application/json)
- + Body
- { "type": "ERR_FOUND", "code": 404, "message": "Not found"}
- ## Gallery [/upload]
- ### Upload [POST /upload/:object_name/:object_id]
- + Request (application/json)
- + Header
- Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJJZCI6IjViOWMwYmJlZGUxMDF...
- + Body
- {"files": ["multipart/data"]}
- + Response 200 (application/json)
- + Body
- ["/upload/products/5bae4798ad2a780001fc16fa/icBI21wW4TiMDPFFgc0jIxuFIsGfGL.jpg"]
- + Response 400 (application/json)
- + Body
- {"type":"ERR_REQUEST","code":400,"message":"Upload file is not a valid image"}
- + Response 403 (application/json)
- + Body
- {"type": "ERR_REQUEST", "code": 403, "message": "Permission denied"}
- ### Image Resize [GET /upload/:object_name/:object_id/:path(?w,h)]
- + Parameters
- + w (optional, Number) ... resize image width
- + h (optional, Number) ... resize image height
- + Response 200 (image/jpg)
- + Response 404
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement