POST | /Discount/DiscountUndelete | Undeletes a discount | Uses your API Key and the ID of the discount you want to undelete (DiscountIDToUndelete) the specified discount if it exists.
A. Undelete 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"
}
} Now the list with the existing discounts.
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": 346,
"DiscountName": "discount",
"DiscountDescription": "",
"DiscountValue": 10
}
],
"ResponseStatus": {
"ErrorCode": "0"
}
}
Then we decide to reset the Halloween discount from our list of discounts.
Value: {
"DiscountIDToUnDelete": 354
}
Response: {
"result": true,
"ResponseStatus": {
"ErrorCode": "0"
}
} Then we decide to remove the Halloween discount from our list of discounts.
B. Trying to undelete a discount that does not exist.
Value: {
"DiscountIDToUnDelete": 11
}
Response: {
"result": false,
"ResponseStatus": {
"ErrorCode": "500",
"Message": "The Discount with ID [11] does not exist. Undelete failed"
},
"InternalErrorCode": "DiscountNotExists"
}
|
---|