CancelOrder API Request
  • 12 Aug 2022
  • 3 Minutes to read
  • Contributors
  • Dark
    Light

CancelOrder API Request

  • Dark
    Light

Article summary

The following details how to cancel a fulfillment order with Mercury via an API request.

The CancelOrder API request should not be confused with the Cancel API request, which is used to unprocess standard (non-fulfillment) shipments.

Overview

The protocol is based on XML data exchange with HTTP used as a transport. A non-validating parser is used and hence no internal or external DTD needs to be specified. The data must be well formed and all validation is handled at the application (not parser) level. Error handling will be done by always including the <Errors> container in the response. The Errors element will not be returned if no errors are found.

Connection

To connect to the site, use the following HTTPS URL via regular POST method with the parameter RQXML=<your xml document> https://api.landmarkglobal.com/v2/CancelOrder.php

Encoding

Mercury uses UTF-8 for character encoding. If your system outputs in an encoding other than UTF-8, please include an encoding flag in your XML header. 

     Example: <?xml version="1.0" encoding="UTF-8"?>

     Example: <?xml version="1.0" encoding="ISO-8859-1"?>

Test Mode

When first given access to the API, the client will be placed in Test mode. Requests made while in test mode will not act on live data. After approval has been received to go live from Landmark, all requests are active unless the <Test> flag is passed.  During a test API call orders will not be cancelled but errors will be reported when appropriate.

CancelOrderRequest

This request will cancel a fulfillment order so long as the corresponding shipment has not yet been allocated or processed. The canceled order will be deleted and will no longer remain in the fulfillment queue. Standard (non-fulfillment) shipments may be held before processing. Standard shipments will not be cancelled by this API.

This would typically be used to cancel order before the label has been processed.

<CancelOrderRequest>

     <Login>

          <Username>demoapi</Username>

          <Password>demo123</Password>

     </Login>

     <Test>true</Test> <!-- Optional. Defaults to TRUE before account activation, FALSE afterwards -->

     <ClientID>218</ClientID> <!-- Required -->

     <!-- Only one of these three is required: Reference or PackageReference or TrackingNumber -->

     <Reference></Reference>

     <PackageReference></PackageReference>

     <TrackingNumber></TrackingNumber>

     <Reason></Reason> <!-- Optional -->

</CancelOrderRequest> 

CancelOrderResponse

<CancelOrderResponse>

     <Errors> <!-- Only if Error(s) occur is this element included -->

          <Error>

               <ErrorCode>Duplicate</ErrorCode>

               <ErrorMessage>More than one shipment found with that reference (use TrackingNumber</ErrorMessage>

         </Error>

     </Errors>

     <Result>

          <Success>true</Success>

          <ResultMessage>Successfully unprocessed shipment with reference 3245325</ResultMessage>

     </Result>

</CancelOrderResponse>

Possible Errors

This table lists all errors that may be returned by the CancelOrder API endpoint. [Brackets] in the ErrorMessage are used to represent to the value passed for the related element. An example is provided when an ErrorMessage is variable.

Related Element(s)ErrorMessageDetails/Action
General Errors
User, APIUser [username] does not have permissions to this API
Failure authenticating user
User is not available. Check your username/password
N/AUnable to parse charactersEnsure that special characters are properly encoded and an encoding flag is included in your XML header.

Example: <?xml version=""1.0"" encoding=""UTF-8""?>

Example: <?xml version=""1.0"" encoding=""ISO-8859-1""?>

<Login> Errors
LoginRequired element Login not foundProvide login credentials and verify the XML can be parsed
Login name not provided


User, ClientID
Request is missing client ID
Unable to authenticate the user credentials
Client is inactive
Client has been deactivated. Permission denied
User [username] does not have permissions to client: [clientID]
Unable to determine desired client for this userIf user has access to more than one client, the ClientID is required
Username, passwordThe username/password combination provided is invalid
The username/password combination provided is disabled
Password not provided
Errors Specific to CancelOrder API
Reference, PackageReference, TrackingNumberA Landmark tracking number, shipment reference, or package reference must be provided

ClientID, shipmentUnable to retrieve a shipment for ClientID [client id]
ShipmentShipment [tracking number] has already been processed and cannot be cancelled

Shipment [tracking number] has already been held from processing
Failed to hold the shipment [tracking number]
Failed to load a shipment with the given parameters
More than one shipment was found under this criteria.  Please refine the search
N/AFailed to cancel. [error details]


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.