POST | /Discount/DiscountUpdate | Inserts a discount or updates a current discount. | Uses your API Key and applies a mvRecordAction
value on an mvDiscount object. We can insert the mvDiscount object we specified using
"Insert" as our mvRecordAction. We can update a current discount using "Update", we can
insert a discount if it doesn't already exist, update a discount if it does exist using "InsertOrUpdate" and we
can insert new fields or update non-empty fields of the discount using "InsertOrUpdateNonEmptyFields".
Optionally, you can use mvInsertUpdateDeleteSourceApplication when an external application ( eg Magento )
is the one that triggers the DiscountUpdate call. Only the DiscountDescription can be changed during the update.
A. Insert a discount.
Value: {
"mvDiscount": {
"DiscountID": 9,
"DiscountName": "Summer Discount",
"DiscountDescription": "Time for a swim",
"DiscountValue": 4
},
"mvRecordAction": "Insert",
"mvInsertUpdateDeleteSourceApplication": "WooCommerce"
}
Response: {
"mvDiscount": {
"DiscountID": 9,
"DiscountName": "Summer Discount",
"DiscountDescription": "Time for a swim",
"DiscountValue": 4
},
"ResponseStatus": {
"ErrorCode": "0"
},
"entityID": 9
}
B.
Lets try to change the value and the name of a discount.
Value: {
"mvDiscount": {
"DiscountID": 9,
"DiscountName": "Start of Summer season",
"DiscountValue": 7.5
},
"mvRecordAction": "InsertOrUpdate"
}
Response: {
"ResponseStatus": {
"ErrorCode": "500",
"Message": "Only the DiscountDescription can be changed during the update. Update Failed"
},
"entityID": 0,
"InternalErrorCode": "OnlyDiscountDescriptionUpdatable"
}
|
---|