How to import orders with the Click & Drop API

The Click & Drop API is an integration that allows you to create orders in Click & Drop via API from your own order management systems. This is suitable for eCommerce companies and websites that do not already have a direct integration with Click & Drop.

Please note that some level of development knowledge is required to import orders into Click & Drop by this method.

For developer documentation, click here: https://api.parcel.royalmail.com/

Contents:

  1. Getting started
  2. Creating an integration
  3. Authentication
  4. Actions
    4a. Create order
    4b. Retrieve orders
  5. Troubleshooting

1. Getting started

If you use your own order management systems, or you use an eCommerce integration which does not currently have a direct integration to Click & Drop, you can use the Public API to create orders within your Click & Drop account.

What the public API can do: 

  • Create one or more orders in Click & Drop
  • Retrieve order information from Click & Drop

What the Public API cannot do:

  • Retrieve labels

2. Creating an integration

To begin, log into your Click & Drop account, and navigate to 'Settings' > 'Integrations'.

IntegrationsBlank.png

From the list that appears, select 'Click & Drop API'.

IntegrationBlank.png

You will be presented with several integration settings:

Default trading name: Select your default trading name from the drop down list. If you only have one trading name, it will be automatically entered. This trading name will determine the return address that is displayed on your labels.

Integration name: Choose the name your integration will be displayed under within Click & Drop.

Use address book reference: If you have previously added customer details into your Address book, you can enter the Address Book reference into your spreadsheet and select this option. If you do, the address, city, and postcode data will be automatically included with your order. This means you will not have to map those individual fields.

For more information, see this guide: Setting up your address book

Use shipping address for billing address: Click & Drop allows you to map both shipping and billing address data. If you select this option, you will only need to map the fields for shipping address data. This option is selected by default.

Update product data: With this option selected, any product in Click & Drop with the same SKU and name values as a products included with your imported orders will be updated so that values such as weight and package size will be updated to match your imported data.  

Create batches for the imported orders: Click this option if you wish for your imported orders to be automatically placed in batches. This occurs per API call, so if your API call contains 5 orders, all five will be placed in a single batch.

Click the 'Update' button when you are ready.

IntegrationSettings.png

A row for your integration will be visible in your 'Integrations' page grid. Click the row to expand the grid. From here you can edit your integration settings, and view your authentication key. 

APiRow.png

Please note that only one Public API integration can be created per account. Should you wish to import orders with a different trading name or company identity, you will need to specify this information in the call itself, see section 4 below.

3. Authentication

Developers, click here for developer docs: https://api.parcel.royalmail.com/

The Public API uses API keys to authenticate requests.

From the integration settings page within Click & Drop, click your Public API integration to expand the row. Your authorisation (auth) key will be displayed here. 

IntegrationSettingsPlusAuth.png

It is important that you keep your API key secret and do not share it publicly.

You will need to pass this auth key in the header of every API call made to Click & Drop. Any API requests made without authorisation will fail.

Example cURL header:
curl --location --request POST 'https://api.parcel.royalmail.com/api/v1/Orders' \

--header 'Authorization: aaaaaa-bbbb-cccc-dddd-eeeeeeee' \

--header 'Content-Type: application/json' \

4. Actions

Developers, click here for developer docs: https://api.parcel.royalmail.com/

4a. Create order

You can use the API to create orders in your Click & Drop account. When creating an order, items must match the specific format and examples detailed in the developer docs.

Please note, orders created can be either in 'new', or 'Postage applied' statuses. 

In order to generate a label for an order, you must pass a minimum of Order Weight, Service Code, and Packaging Format values, otherwise the order will be created in 'New' status and will require you to apply postage to the order in the website. 

Many international orders have additional customs data requirements that must be passed.

Multiple items can be sent by nesting multiple sets of item details. 

4b. Retrieve orders

By altering the URL, you can retrieve specific information about one or more orders. 

The data returned is detailed in our developer docs.

To retrieve information, edit the URL and add one or more Click & Drop order numbers or channel reference numbers separated by semicolons. 

Example:

{{baseURL}}/{{version}}/Orders/30234;30235

5. Troubleshooting

What is the baseURL?

The baseURL for creating orders is https://api.parcel.royalmail.com/api/v1

Please note that this will change as future versions of the API are released.

Explanation of error codes:

400 - Bad Request (Request has missing or invalid parameters and cannot be parsed)

This error usually means some invalid data has been passed. Check the response received for further information about individual fields. 

401 - unauthorized

This error usually means the has been an issue with your auth key. Either the auth code does not match, or was not passed in the header.

403 - Forbidden

This error usually means you are attempting to access an endpoint which is forbidden for your account type.

500 - Internal server error

This error usually means a connection could not be established. Check the health of your connection, and check our status page where any known issues with Click & Drop will be posted. 

Minimum system requirements:

If you are using browsers or software on Windows machines, please ensure that the system, device, or browser you are using supports Transport Layer Security (TLS) version 1.2 or higher.