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.20.0-SNAPSHOT
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Requirements.
Python 3.9+
Installation & Usage
pip install
If the python package is hosted on a repository, you can install directly using:
(you may need to runpip with root permission: sudo pip install git+https://https://github.com/niccokunzmann/python-royal-mail-click-and-drop-api.git)
Then import the package:
Setuptools
Install via Setuptools.
(orsudo python setup.py install to install the package for all users)
Then import the package:
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.LabelsApi(api_client)
order_identifiers = 'order_identifiers_example' # str | One or several Order Identifiers or Order References separated by semicolon. Order Identifiers are integer numbers. Order References are strings - each must be percent-encoded and surrounded by double quotation marks. The maximum number of identifiers is 100. E.g. /orders/\"ref\";1001;\"Reference%3BWith%3BSpecial%3BSymbols!\";2345/
document_type = 'document_type_example' # str | Document generation mode. When documentType is set to \"postageLabel\" the additional parameters below must be used. These additional parameters will be ignored when documentType is not set to \"postageLabel\"
include_returns_label = True # bool | Include returns label. Required when documentType is set to 'postageLabel' (optional)
include_cn = True # bool | Include CN22/CN23 with label. Optional parameter. If this parameter is used the setting will override the default account behaviour specified in the \"Label format\" setting \"Generate customs declarations with orders\" (optional)
try:
# Return a single PDF file with generated label and/or associated document(s)
api_response = api_instance.get_orders_label_async(order_identifiers, document_type, include_returns_label=include_returns_label, include_cn=include_cn)
print("The response of LabelsApi->get_orders_label_async:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling LabelsApi->get_orders_label_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 |
|---|---|---|---|
| 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 |
| 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 |
| VersionApi | get_version_async | GET /version | Get API version details. |
Documentation For Models
- AddressRequest
- BillingDetailsRequest
- CreateOrderErrorResponse
- CreateOrderLabelErrorResponse
- CreateOrderRequest
- CreateOrderResponse
- CreateOrdersRequest
- CreateOrdersResponse
- CreatePackagesResponse
- DeleteOrdersResource
- DeletedOrderInfo
- DimensionsRequest
- ErrorResponse
- FailedOrderResponse
- GetOrderDetailsResource
- GetOrderInfoResource
- GetOrderLineResult
- GetOrdersDetailsResponse
- GetOrdersResponse
- GetPostalDetailsResult
- GetShippingDetailsResult
- GetTagDetailsResult
- GetVersionResource
- Importer
- LabelGenerationRequest
- ManifestDetailsResponse
- ManifestEligibleOrdersRequest
- ManifestErrorsErrorDetailsResponse
- ManifestErrorsResponse
- ManifestOrdersResponse
- OrderErrorInfo
- OrderErrorResponse
- OrderFieldResponse
- OrderUpdateError
- PostageDetailsRequest
- ProductItemRequest
- RecipientDetailsRequest
- SenderDetailsRequest
- ShipmentPackageRequest
- TagRequest
- UpdateOrderStatusRequest
- UpdateOrderStatusResponse
- UpdateOrdersStatusRequest
- UpdatedOrderInfo
Documentation For Authorization
Authentication schemes defined for the API:
Bearer
- Type: API key
- API key parameter name: Authorization
- Location: HTTP header