Megaventory API v2017a

<back to all web services

SalesOrderCancel

The following routes are available for this service:
POST/SalesOrder/SalesOrderCancelCancels a sales orderUses your API Key, the Number of the sales order you want to cancel (mvSalesOrderNoToCancel) and cancels the specified sales order if its status is Pending or Verified. Optionally, you can use mvInsertUpdateDeleteSourceApplication when an external application ( eg Magento ) is the one that triggers the SalesOrderCancel call.

Examples:



A.

Cancel a sales order. First use The SalesOrderGet to find the Sales Order number

Value:

{
   "mvSalesOrderNoToCancel": "83",
   "mvInsertUpdateDeleteSourceApplication": "WooCommerce"
}


Response:

{
   "result": true,
   "ResponseStatus": {
      "ErrorCode": "0"
   }
} 

B.

Trying to cancel an order that is Closed.

Value:

{
   "mvSalesOrderNoToCancel": 19,
   "mvInsertUpdateDeleteSourceApplication": "Magento"
}


Response:

 {
   "result": false,
   "ResponseStatus": {
      "ErrorCode": "500",
      "Message": "A Sales Order can only be Cancelled when the SalesOrderStatus is Pending or Verified. Sales Order Cancel Failed"
   },
   "InternalErrorCode": ""
} 

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/SalesOrderCancel HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/jsv
Content-Length: length

{
	APIKEY: String,
	mvSalesOrderNoToCancel: String,
	mvSalesOrderTypeId: 0,
	mvInsertUpdateDeleteSourceApplication: String
}
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
}