Dette dokumentet forklarer hvordan server-siden av REST-api'et er satt opp.
Type: GET
URI: host:port/clothingStorage http://localhost:8080/clothingStorage
Response:
{
"clothes" : [ {
"type" : "Pants",
"brand" : "Nike",
"size" : "S",
"price" : 10.0,
"discount" : 0.0
}, {
"quantity" : 5
}, {
"type" : "Shorts",
"brand" : "LouisVuitton",
"size" : "M",
"price" : 20.0,
"discount" : 0.0
}, {
"quantity" : 8
}, {
"type" : "Socks",
"brand" : "Adidas",
"size" : "L",
"price" : 30.0,
"discount" : 0.0
}, {
"quantity" : 4
}, {
"isSorted" : false
} ]
}
Type: GET
URI: host:port/clothingStorage/priceNames http://localhost:8080/clothingStorage/priceNames
Response:
{
[
"PantsNikeS",
"ShortsLouisVuittonM",
"SocksAdidasL"
]
}
Type: GET
URI: host:port/clothingStorage/storageNames http://localhost:8080/clothingStorage/storageNames
Response:
{
[
"JacketAdidasL",
"UnderwearLouisVuittonS",
"ShirtSupremeL"
]
}
Type: GET
URI: host:port/clothingStorage/sortedNames http://localhost:8080/clothingStorage/sortedNames
Response:
{
[
"PantsAdidasL",
"JacketLacosteS",
"UnderwearNikeS"
]
}
Type: GET
URI: host:port/clothingStorage/sorted/{id} http://localhost:8080/clothingStorage/sorted/0
Parameter: id
- 0 for lavest pris
- 1 for høyest pris
- 2 for klær på rabatt
Response:
{
[
"Pants; Nike; 10.0kr",
"Shorts; LouisVuitton; 20.0kr",
"Socks; Adidas; 30.0kr"
]
}
Type: GET
URI: host:port/clothingStorage/sortedType/{type} http://localhost:8080/clothingStorage/sortedType/Pants
Parameter: type
Response:
{
[
"Pants; Nike; 86.0kr",
"Pants; Adidas; 99.0kr",
"Pants; Levi's; 25.0kr"
]
}
Type: GET
URI: host:port/clothingStorage/sortedBrand/{brand} http://localhost:8080/clothingStorage/sortedBrand/Nike
Parameter: brand
Response:
{
[
"Pants; Nike; 44.0kr",
"Shorts; Nike; 98.0kr",
"Jacket; Nike; 35.0kr"
]
}
Type: GET
URI: host:port/clothingStorage/storageDisplay http://localhost:8080/clothingStorage/storageDisplay
Response:
{
[
"Jacket; Nike; M; 2",
"Sweater; LouisVuitton; S; 9",
"Shorts; Supreme; L; 4"
]
}
Type: GET
URI: host:port/clothingStorage/priceDisplay http://localhost:8080/clothingStorage/priceDisplay
Response:
{
[
"Pants; Adidas; 40.0kr",
"Underwear; Lacoste; 86.0kr",
"Jacket; Nike; 26.0kr"
]
}
Type: GET
URI: host:port/clothingStorage/clothes/{name} http://localhost:8080/clothingStorage/clothes/PantsNikeM
Parameter: name
Response:
{
"type" : "Pants",
"brand" : "Nike",
"size" : "M",
"price" : 44.0,
"discount" : 0.5
}
Type: PUT
URI: host:port/clothingStorage/clothes/{name} http://localhost:8080/clothingStorage/clothes/JacketLacosteS
Parameter: name
Request:
{
"type" : "Jacket",
"brand" : "Lacoste",
"size" : "S",
"price" : 149.0,
"discount" : 0.0
}
Response:
{
true
}
Type: DELETE
URI: host:port/clothingStorage/clothes/{name} http://localhost:8080/clothingStorage/clothes/SocksNikeL
Parameter: name
Response:
{
true
}
Type: GET
URI: host:port/clothingStorage/quantity/{name} http://localhost:8080/clothingStorage/quantity/PantsNikeS
Response:
{
5
}
Type: PUT
URI: host:port/clothingStorage/quantity/{name} http://localhost:8080/clothingStorage/quantity/SweaterAdidasM
Parameter: name
Request:
{
quantity=5
}
Response:
{
true
}
Type: GET
URI: host:port/clothingStorage/stats/chartData/{type} http://localhost:8080/clothingStorage/stats/chartData/Pants
Parameter: type
Response:
{
[
5,
0,
8
]
}
Type: GET
URI: host:port/clothingStorage/stats/totalQuantity http://localhost:8080/clothingStorage/stats/totalQuantity
Response:
{
17
}
Type: GET
URI: host:port/clothingStorage/stats/totalValue http://localhost:8080/clothingStorage/stats/totalValue
Response:
{
330.0
}