POST | /Discount/DiscountDelete | Deletes a discount | Uses your API Key and the ID of the discount you want to delete (DiscountIDToDelete) to delete the specified discount if it exists.
A. Delete a discount.
To begin with, we use DiscountGet to see all of our existing discounts as shown below:
Value: {}
Response: {
"mvDiscounts": [
{
"DiscountID": 358,
"DiscountName": "End of season",
"DiscountDescription": "",
"DiscountValue": 12.5
},
{
"DiscountID": 357,
"DiscountName": "Start of season",
"DiscountDescription": "",
"DiscountValue": 7.5
},
{
"DiscountID": 356,
"DiscountName": "End of season",
"DiscountDescription": "",
"DiscountValue": 7.5
},
{
"DiscountID": 355,
"DiscountName": "Easter Festivities",
"DiscountDescription": "",
"DiscountValue": 16.5
},
{
"DiscountID": 354,
"DiscountName": "Halloween Discount",
"DiscountDescription": "Halloween Festivities",
"DiscountValue": 16.5
},
{
"DiscountID": 346,
"DiscountName": "discount",
"DiscountDescription": "",
"DiscountValue": 10
}
],
"ResponseStatus": {
"ErrorCode": "0"
}
}
Then we decide to remove the Halloween discount from our list of discounts.
Value: {
"DiscountIDToDelete": 354
}
Response: {
"result": true,
"ResponseStatus": {
"ErrorCode": "0"
}
}
B. Trying to delete a discount that does not exist.
Value: {
"DiscountIDToDelete": 11
}
Response: {
"result": false,
"ResponseStatus": {
"ErrorCode": "500",
"Message": "The Discount with ID [11] does not exist. Delete failed"
},
"InternalErrorCode": "DiscountNotExists"
}
|
---|