Get a list of products in stcok
Request Format
GET /prodcut
Header
Accept: "application/json"
Response Format
Header
Content-type: "application/json"
Status: 200
Body
[
{
"id": "58c95380198e9228f7e4c19e",
"name": "Nokia Avenger 4000",
"detail": "Captain Swear Police edition",
"price": 10900,
"amount": 420,
"owner": "Stan Lee",
"saleDate": 1489589120,
"editDate": 1489589120,
"category":
{
"id": "58c946f3198e251b73ecd1ac",
"name": "Electronic Accessory",
"childs": ["Backup Battery"],
"parents": ["IT"]
}
}
]
Create new Product
Request Format
POST /product
Header
Content-type: "application/json"
Body
{
"name": "Samsung Ga",
"detail": "Captain Swear Police edition",
"price": 10900,
"amount": 420,
"owner": "Stan Lee",
"saleDate": 1489589120,
"editDate": 1489589120,
"category":
{
"id": "58c946f3198e251b73ecd1ac",
"name": "Electronic Accessory",
"childs": ["Backup Battery"],
"parents": ["IT"]
}
}
Get information of select product
Request Format
GET /product/{id}
Header
Accept: "application/json"
Response Format
Header
Content-type: "application/json"
Status: 200
Body
{
"id": "58c95380198e9228f7e4c19e",
"name": "Nokia Avenger 4000",
"detail": "Captain Swear Police edition",
"price": 10900,
"amount": 420,
"owner": "Stan Lee",
"saleDate": 1489589120,
"editDate": 1489589120,
"category":
{
"id": "58c946f3198e251b73ecd1ac",
"name": "Electronic Accessory",
"childs": ["Backup Battery"],
"parents": ["IT"]
}
}
Update information of select product
Request Format
PUT /product/{id}
Header
Accept: "application/json"
Response Format
Header
Content-type: "application/json"
Status: 200
Body
{
"name": "Nokia Avenger 4000",
"detail": "Captain Swear Police edition",
"price": 15000,
"amount": 420,
"owner": "Stan Lee",
"saleDate": 1489589120,
"editDate": 1489589120,
"category":
{
"id": "58c946f3198e251b73ecd1ac",
"name": "Electronic Accessory",
"childs": ["Backup Battery"],
"parents": ["IT"]
}
}
Delete select product out of stock
Request Format
DELETE /product/{id}
Header
Accept: "text/plain; charset=utf-8"
Response Format
Header
Content-type: "text/plain; charset=utf-8"
Status: 200
Body
// Prodcut's id
58c95380198e9228f7e4c19e
Get a list of products based on a Category
Request Format
GET /product/category/{categoryName}
Header
Accept: "text/plain; charset=utf-8"
Response Format
Header
Content-type: "application/json"
Status: 200
Body
[
{
"id": "58d6310d20e1c10c985bf3ba",
"name": "Samsung Galaxy Andromeda",
"detail": "Mass Effect Andromeda Limited Edition",
"price": 29000,
"amount": 300,
"owner": "Samsung Electronics Co., Ltd.",
"saleDate": 1490432269,
"editDate": 1490433144,
"category": {
"id": "58d62a7720e1c10c985bf3b3",
"name": "Mobile Phone",
"children": [ "" ],
"parents": [ "Mobile Phone and Tablet" ]
}
}
]
Add image of selected product
Request Format
POST /product/image?productId={id}
Header
Content-type: "multipart/form-data"
Body
Product's Image
Response Format
Header
Content-type: "text/plain; charset=utf-8"
Status: 201
Body
// Prodcut's id
58c95380198e9228f7e4c19e
Get Image of selected product
Request Format
GET /product/image/{productId}
Header
Response Format
Header
Content-type: "image/jpeg"
Content-Disposition: attachment; filename="{filename.jpg}"
Status: 200
Body
Image of Selected Product
Create Product's Category
Request Format
POST /category
Header
Accept: "application/json"
Body
{
"name" : "Mobile Accessory",
"children" : [
"Backup Battery", "Battery and Charging Accessory", "Mobile Case” ],
"parents": [ "Mobile Phone and Tablet" ]
}
Response Format
Header
Content-type: "application/json"
Status: 201
Body
{
"58d62a8320e1c10c985bf3b5"
}
Get list of Product's Categories
Request Format
GET /category
Header
Accept: "text/plain; charset=utf-8"
Response Format
Header
Content-type: "application/json"
Status: 200
Body
[
{
"id": "58d62a7220e1c10c985bf3b2",
"name": "Mobile Phone and Tablet",
"children": [ "Mobile Phone", "Tablet", "Mobile Accessory“ ],
"parents": [ "" ]
}
]
Get Category's Information
Request Format
GET /category/{categoryName}
Header
Accept: "text/plain; charset=utf-8"
Response Format
Header
Content-type: "application/json"
Status: 200
Body
{
"id": "58d62a7720e1c10c985bf3b3",
"name": "Mobile Phone",
"children": [ "" ],
"parents": [ “Mobile Phone and Tablet" ]
}
Modify a selected category's information
Request Format
PUT /category/{categoryName}
Header
Accept: "application/json"
Body
{
"name": "Mobile Phone",
"children": [ “iPhone”, “Android” ],
"parents": [ “Mobile Phone and Tablet" ]
}
Response Format
Header
Content-type: "application/json"
Status: 200
Body
{
"58d62a7720e1c10c985bf3b3"
}
Remove a selected category
Request Format
DELETE /category/{categoryName}
Header
Accept: "text/plain; charset=utf-8"
Response Format
Header
Content-type: "text/plain; charset=utf-8"
Status: 200