Megaventory API v2017a

<back to all web services

DiscountDelete

The following routes are available for this service:
POST/Discount/DiscountDeleteDeletes a discountUses your API Key and the ID of the discount you want to delete (DiscountIDToDelete) to delete the specified discount if it exists.

Examples:



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"
    } 

To override the Content-type in your clients HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /csv/reply/DiscountDelete HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/csv
Content-Length: length

APIKEY,DiscountIDToDelete,mvInsertUpdateDeleteSourceApplication
String,0,String

HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

result,ResponseStatus,InternalErrorCode
False,"{ErrorCode:String,Message:String,StackTrace:String,Errors:[{ErrorCode:String,FieldName:String,Message:String}]}",String