-
Notifications
You must be signed in to change notification settings - Fork 3
Shops APIs
Vijayalaxmi edited this page Oct 1, 2020
·
3 revisions
Create Shops
Endpoint: /shops
HTTP Method: POST
RequestBody
{
"type":"shop",
"name":"",
"location":"",
"shopCode": ""
}
HTTP code: 201
Response Body
{
"type": "product",
"status": "Success",
"payload": { // Shop JSON Entity
"type":"shop",
"name":"",
"location":"",
"shopCode": "",
"createdat": "",
"updatedat": ""
}
}
Error Cases
Http Code: 409 (When shop already exists)
Error Response
{
"type": "error",
"status": "Failure"
"payload": {
"errorCode": 409
"errorMessage": "Shop already exists"
}
}
Get All Products / Get All Shops
Endpoint: /shops
HTTP Method: GET
HTTP Code: 200
Response Body
{
"type": "shops",
"status": "Success"
"payload": [
{
"type":"shop", // Shop JSON Entity
"name":"",
"location":"",
"shopCode": "",
"createdat": "",
"updatedat": ""
},
{},
{},
{}
]
"page" : 1, // Paging information, this might not be required as of now
"size" : 10,
"lastPage" : true
}
There will be no error case for this API, only generic 500 internal server error can occur
Get Product details
Endpoint: /shops/<shopId>
HTTP Method: GET
HTTP Code: 200
{
"type": "product",
"status" : "Success"
"payload": {
"type":"shop", // Shop JSON Entity
"name":"",
"location":"",
"shopCode": "",
"createdat": "",
"updatedat": ""
}
}
Update Product
Endpoint: /shops/<shopId>
HTTP Method: PUT
HTTP Code: 200
{
"type":"shop", //Non Editable
"name":"",
"location":"",
"shopCode": ""
}
Response Body:
{
"type": "product",
"status" : "Success"
"payload": {
"type":"shop", // Shop JSON Entity
"name":"",
"location":"",
"shopCode": "",
"createdat": "",
"updatedat": ""
}
}
Error Cases
Http Code: 404
Error Response
{
"type": "error",
"status": "Failure"
"payload": {
"errorCode": 404
"errorMessage": "product dose not exist"
}
}
Delete Product
Endpoint: /shops/<shopId>
HTTP Method: DELETE
HTTP Code: 200 OK
Error Cases
Http Code: 404
Error Response
{
"type": "error",
"status": "Failure"
"payload": {
"errorCode": 404
"errorMessage": "product dose not exist"
}
}