Skip to content

Repository files navigation

rmail-apiv3

This API specification details the requirements for integrating with Royal Mail API Shipping V3.

It specifically covers how the Royal Mail API Shipping V3 can be used by business customers to conduct shipping activity with Royal Mail and provides the technical information to build this integration. This specification must be used with the relevant accompanying specifications for customers wishing to interface their systems with Royal Mail services.

Royal Mail API Shipping V3 exposes a fully RESTful service that allows account customers to create shipments, produce labels, and produce documentation for all the tasks required to ship domestic items with Royal Mail.

Built on industry standards, Royal Mail API Shipping V3 provides a simple and low cost method for customers to integrate with Royal Mail, and allows them to get shipping quickly. The API offers data streaming and offline barcoding to allow customers greater flexibility when generating their labels. There are no costs to customers for using the Royal Mail API Shipping V3 services, however customers’ own development costs must be covered by the customer developing the solution. Royal Mail will not accept any responsibility for these development, implementation and testing costs. Customers should address initial enquiries regarding development of systems for these purposes to their account handler.

This API can be used in conjunction with Royal Mail Pro Shipping, a GUI based shipping platform. For more details on Royal Mail Pro Shipping, including videos on and briefs on updating/ cancelling a shipment and Manifesting please refer to http://www.royalmail.com/pro-shipping-help.

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 3.0.12
  • Package version: 0.0.1
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

importrmail_apiv3

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

importrmail_apiv3

Getting Started

Please follow the installation procedure and then run the following:

from __future__ importprint_functionimporttimeimportrmail_apiv3fromrmail_apiv3.restimportApiExceptionfrompprintimportpprint# Configure API key authorization: clientIDconfiguration=rmail_apiv3.Configuration()
configuration.api_key['X-IBM-Client-Id'] ='YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['X-IBM-Client-Id'] = 'Bearer'# create an instance of the API classapi_instance=rmail_apiv3.AddressesApi(rmail_apiv3.ApiClient(configuration))
body=rmail_apiv3.Address() # Address | The address.x_rmg_auth_token='x_rmg_auth_token_example'# str | Authorisation token required to invoke this operation. Can be retrieved by invoking the **/token** operation.try:
# Create Addressapi_response=api_instance.addresses_create(body, x_rmg_auth_token)
pprint(api_response)
exceptApiExceptionase:
print("Exception when calling AddressesApi->addresses_create: %s\n"%e)
# Configure API key authorization: clientIDconfiguration=rmail_apiv3.Configuration()
configuration.api_key['X-IBM-Client-Id'] ='YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['X-IBM-Client-Id'] = 'Bearer'# create an instance of the API classapi_instance=rmail_apiv3.AddressesApi(rmail_apiv3.ApiClient(configuration))
x_rmg_auth_token='x_rmg_auth_token_example'# str | Authorisation token required to invoke this operation. Can be retrieved by invoking the **/token** operation.address_id='address_id_example'# str | Your unique Address ID of the address to delete.try:
# Delete Addressapi_response=api_instance.addresses_delete(x_rmg_auth_token, address_id)
pprint(api_response)
exceptApiExceptionase:
print("Exception when calling AddressesApi->addresses_delete: %s\n"%e)
# Configure API key authorization: clientIDconfiguration=rmail_apiv3.Configuration()
configuration.api_key['X-IBM-Client-Id'] ='YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['X-IBM-Client-Id'] = 'Bearer'# create an instance of the API classapi_instance=rmail_apiv3.AddressesApi(rmail_apiv3.ApiClient(configuration))
x_rmg_auth_token='x_rmg_auth_token_example'# str | Authorisation token required to invoke this operation. Can be retrieved by invoking the **/token** operation.address_id='address_id_example'# str | Your unique Address ID.try:
# Get Addressapi_response=api_instance.addresses_get(x_rmg_auth_token, address_id)
pprint(api_response)
exceptApiExceptionase:
print("Exception when calling AddressesApi->addresses_get: %s\n"%e)
# Configure API key authorization: clientIDconfiguration=rmail_apiv3.Configuration()
configuration.api_key['X-IBM-Client-Id'] ='YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['X-IBM-Client-Id'] = 'Bearer'# create an instance of the API classapi_instance=rmail_apiv3.AddressesApi(rmail_apiv3.ApiClient(configuration))
x_rmg_auth_token='x_rmg_auth_token_example'# str | Authorisation token required to invoke this operation. Can be retrieved by invoking the **/token** operation.try:
# Get Addressesapi_response=api_instance.addresses_get_all(x_rmg_auth_token)
pprint(api_response)
exceptApiExceptionase:
print("Exception when calling AddressesApi->addresses_get_all: %s\n"%e)
# Configure API key authorization: clientIDconfiguration=rmail_apiv3.Configuration()
configuration.api_key['X-IBM-Client-Id'] ='YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['X-IBM-Client-Id'] = 'Bearer'# create an instance of the API classapi_instance=rmail_apiv3.AddressesApi(rmail_apiv3.ApiClient(configuration))
body=rmail_apiv3.Address() # Address | The address with the updated details.x_rmg_auth_token='x_rmg_auth_token_example'# str | Authorisation token required to invoke this operation. Can be retrieved by invoking the **/token** operation.address_id='address_id_example'# str | Your unique Address ID of the address to update.try:
# Update addressapi_response=api_instance.addresses_update(body, x_rmg_auth_token, address_id)
pprint(api_response)
exceptApiExceptionase:
print("Exception when calling AddressesApi->addresses_update: %s\n"%e)

Documentation for API Endpoints

All URIs are relative to /shipping/v3

ClassMethodHTTP requestDescription
AddressesApiaddresses_createPOST /addressesCreate Address
AddressesApiaddresses_deleteDELETE /addresses/{addressId}Delete Address
AddressesApiaddresses_getGET /addresses/{addressId}Get Address
AddressesApiaddresses_get_allGET /addressesGet Addresses
AddressesApiaddresses_updatePUT /addresses/{addressId}Update address
ItemsApiitems_createPOST /itemsCreate Item
ItemsApiitems_deleteDELETE /items/{itemId}Delete Item
ItemsApiitems_getGET /items/{itemId}Get Item
ItemsApiitems_get_allGET /itemsGet Items
ItemsApiitems_updatePUT /items/{itemId}Update item
ManifestsApimanifests_createPOST /manifestsManifest All Shipments
ManifestsApimanifests_create_by_carrierPOST /manifests/bycarrierManifest by Carrier Code(s)
ManifestsApimanifests_create_by_servicePOST /manifests/byserviceManifest by Service Code(s)
PackagingApipackaging_createPOST /packagingCreate Packaging
PackagingApipackaging_deleteDELETE /packaging/{packagingId}Delete Packaging
PackagingApipackaging_getGET /packaging/{packagingId}Get Packaging
PackagingApipackaging_get_allGET /packagingGet All Packaging
PackagingApipackaging_updatePUT /packaging/{packagingId}Update packaging
ShipmentsApishipments_cancelPUT /shipments/cancelCancel Shipments
ShipmentsApishipments_createPOST /shipmentsCreate Shipment
ShipmentsApishipments_deferPUT /shipments/deferDefer Shipments
ShipmentsApishipments_holdPUT /shipments/holdHold Shipments
ShipmentsApishipments_print_documentPUT /shipments/{shipmentId}/printDocumentPrint Document
ShipmentsApishipments_print_labelPUT /shipments/{shipmentId}/printLabelPrint Label
ShipmentsApishipments_releasePUT /shipments/releaseRelease Shipments
ShipmentsApishipments_service_availabilityPOST /shipments/serviceAvailabilityService Availability
TokenApiauthenticate_postPOST /tokenAuthenticates a User and provides token.

Documentation For Models

Documentation For Authorization

clientID

  • Type: API key
  • API key parameter name: X-IBM-Client-Id
  • Location: HTTP header

clientSecret

  • Type: API key
  • API key parameter name: X-IBM-Client-Secret
  • Location: HTTP header

Author

About

Royal Mail Shipping v2 and v3 REST API client for python

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages