Skip to content

click-and-drop-api

Import your orders, retrieve your orders and generate labels.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • Package version: 1.0.0
  • Generator version: 7.27.0-SNAPSHOT
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 3.11+

Packaging uses standard [project] metadata and [dependency-groups] (PEP 621/735). Install the package with python -m pip install .; install development dependencies with Poetry 2.2 or newer using poetry install, or pip 25.1 or newer using python -m pip install --group dev. The latter installs the group, not the package.

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://https://github.com/niccokunzmann/python-royal-mail-click-and-drop-api.git
(you may need to run pip with root permission: sudo pip install git+https://https://github.com/niccokunzmann/python-royal-mail-click-and-drop-api.git)

Then import the package:

import click_and_drop_api

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:

import click_and_drop_api

Tests

Execute pytest to run the tests.

Getting Started

Please follow the [installation procedure] and then run the following:

import click_and_drop_api
from click_and_drop_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://api.parcel.royalmail.com/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = click_and_drop_api.Configuration(
    host = "http://api.parcel.royalmail.com/api/v1"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Bearer
configuration.api_key['Bearer'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Bearer'] = 'Bearer'


# Enter a context with an instance of the API client
with click_and_drop_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = click_and_drop_api.CarriersApi(api_client)

    try:
        # Retrieve list of carriers for the account
        api_response = api_instance.get_carriers_async()
        print("The response of CarriersApi->get_carriers_async:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling CarriersApi->get_carriers_async: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://api.parcel.royalmail.com/api/v1

Class Method HTTP request Description
CarriersApi get_carriers_async GET /carriers Retrieve list of carriers for the account
LabelsApi get_orders_label_async GET /orders/{orderIdentifiers}/label Return a single PDF file with generated label and/or associated document(s)
ManifestsApi get_manifest_async GET /manifests/{manifestIdentifier} Get manifest
ManifestsApi manifest_eligible_async POST /manifests Manifest eligible orders
ManifestsApi retry_manifest_async POST /manifests/retry/{manifestIdentifier} Retry manifest
OlpServicesApi services_olp_get GET /services/olp List available Royal Mail OLP shipping services
OrdersApi create_orders_async POST /orders Create orders
OrdersApi delete_orders_async DELETE /orders/{orderIdentifiers} Delete orders
OrdersApi get_orders_async GET /orders Retrieve pageable list of orders
OrdersApi get_orders_with_details_async GET /orders/full Retrieve pageable list of orders with details
OrdersApi get_specific_orders_async GET /orders/{orderIdentifiers} Retrieve specific orders
OrdersApi get_specific_orders_with_details_async GET /orders/{orderIdentifiers}/full Retrieve details of the specific orders
OrdersApi update_orders_status_async PUT /orders/status Set order status
ReturnsApi returns_post POST /returns Create a return shipment
ReturnsApi returns_services_get GET /returns/services List available return services
ServicesApi get_services_async GET /services Retrieve list of available services for the account, optionally filtered by carrier, destination and package
VersionApi get_version_async GET /version Get API version details.

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

Bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Author

Request headers

Header names are compared case-insensitively in all Python client libraries. Request headers are copied; supplying _headers does not change the caller's dict or the client's shared defaults. The public _headers argument retains its dict validation and existing value serialization. Pydantic can coerce mappings such as HTTPX Headers to a dict, combining repeated fields into a single value; _headers does not provide a repeated-field or list-of-pairs API.

Precedence, from lowest to highest:

  1. _headers (within one dict, the last inserted case variant wins).
  2. Explicit OpenAPI header parameters and generated Content-Type (or _content_type). Generated Accept is added only when neither _headers nor explicit header parameters contain an Accept case variant.
  3. ApiClient.default_headers (including headers set with set_default_header).
  4. The client's cookie setting, for Cookie.
  5. Authentication headers. A non-empty _request_auth replaces configured authentication for that call; {} retains configured authentication. Cookie authentication appends to the selected Cookie value.

This retains the existing precedence for identically spelled names and extends it to case variants. To override a generated content type, use _content_type; client defaults still take precedence over it. The winning header's spelling and value are retained for replacements. Cookie authentication uses the canonical Cookie spelling and appends its value. Values containing legitimate comma-separated lists are not split or deduplicated. This does not remove duplicate values inside a header or change the handling of repeated fields supplied directly to the transport.