Nik's Technology Blog

Travels through programming, networks, and computers

Royal Mail API - Migrating to Pro Shipping API from DMO API

After our Royal Mail API was migrated to the new Pro Shipper API platform in June 2018 our integration stopped working, we were getting the following response back from Royal Mail: "The remote server returned an unexpected response: (405) Method Not Allowed.".

We are using the SOAP version of the API with a .NET client originally based on this example integration by povilaspanavas.

Trying to find any details on what we needed to do to make this upgrade continue to work was difficult as we were under the impression no changes would need to be made from our end. This is the email response we got back from Royal Mail.

 

We are sorry to hear that your API connection has connection issues after migration to Royal Mail Pro Shipper.

If you are receiving blank API responses or “Authorization Failure” responses from the API, your connection issues can be resolved quickly by following the instructions in the attached document and setting up your API Password in Royal Mail Pro Shipper. Until you do this, your API calls will not work.

Please note:-

  1. The confirmation email for migration would have been sent to your DMO email address, your API Developer Portal Address and if you completed the migration web form, the email address listed as the contact email address. If you did not receive the email, please contact shippingsupport@royalmail.com
  2. Your Royal Mail Pro Shipper Login will be the same login username as your DMO email address.
  3. If you changed your API Password in Pro Shipper, you need to advise your IT Developer to update the password in your API calls.

Some important notes about the API migration are:-

  1. If you have coded the API connection in .Net, you will need to update to SOAP 1.2 from SOAP 1.1
  2. The API responses now have an Upper Case element name for SOAP-ENV instead of lower case
  3. The API responses no longer return warnings in the integration footer
  4. The 2D Item ID now returns a hex value instead of a decimal value.
  5. The Channel ID in the 2D barcode has changed. If you are generating the 21 Character UID from the 2D barcode in your system you will need to update your system not to convert the 2D Item ID to Hex and you will need to update the Channel ID.

 

We made sure the API password was set-up correctly in Pro Shipper but that didn't fix the problem.

After some trial and error I managed to fix our integration by adding this HTTP header to the CreateShipment method.

httpRequestProperty.Headers.Add(@"Accept", "application/soap+xml");

And removing all code trying to read warnings in the integration footer, as these are no longer sent back.

 

 

 

 

 

Comments are closed