Skip to content

Shops APIs

Pavan Wadawadagi edited this page Oct 2, 2020 · 3 revisions

APIs for Shops

Create Shops

Endpoint: /shops

HTTP Method: POST

RequestBody

{
	"type": "shop",
	"payload": { 
                   "name":"",
                   "location":"",
	           "shopCode": ""
	         }
}

HTTP code: 201

Response Body

{
	"type": "shop",
        "status": "Success",
	"payload": {           // Shop JSON Entity
                   "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 Shops **

Endpoint: /shops

HTTP Method: GET

HTTP Code: 200

Response Body

{
	"type": "shops",
        "status": "Success",
	"payload": [
		  { 
                   "name":"",  // Shop JSON Entity
                   "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 Shop details

Endpoint: /shops/<shopId>

HTTP Method: GET

HTTP Code: 200

{
	"type": "shop",
        "status" : "Success"
	"payload": { 
                   "name":"", // Shop JSON Entity
                   "location":"",
	           "shopCode": "",
                   "createdat": "",
                   "updatedat": ""
	         }
}

Update Product

Endpoint: /shops/<shopId>

HTTP Method: PUT

HTTP Code: 200


{
	"type": "shop",
        "status" : "Success"
	"payload": { 
                   "name":"", 
                   "location":"",
	           "shopCode": "" //Non Editable         
	         }
}

Response Body:

{
	"type": "shop",
        "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": "Shop does not exists"
        }
	
}

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": "Shop does not exists"
        }
	
}
Clone this wiki locally