Megaventory API v2017a

<back to all web services

DiscountUndelete

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

Examples:



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

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

HTTP + JSV

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

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

{
	APIKEY: String,
	DiscountIDToUndelete: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

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