> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Dhl Location Finder

> Client-mode REST API connectors for the DHL API Developer Portal: Shipment Tracking Unified (every DHL division) with Tracking Push subscriptions, Location Finder service points, DHL Express MyDHL API (rates, landed cost, shipments and labels, pickups, tracking, proof of delivery, paperless trade uploads) and Post & Parcel Germany (Parcel DE Shipping, Pickup and Returns with OAuth); purchases marked; companion server connector for DHL Tracking Push webhooks

Technical Preview

## Overview

Client-mode REST API connectors for the DHL API Developer Portal: Shipment Tracking Unified (every DHL division) with Tracking Push subscriptions, Location Finder service points, DHL Express MyDHL API (rates, landed cost, shipments and labels, pickups, tracking, proof of delivery, paperless trade uploads) and Post & Parcel Germany (Parcel DE Shipping, Pickup and Returns with OAuth); purchases marked; companion server connector for DHL Tracking Push webhooks.

This is one of the templates in the DHL API Developer Portal REST API app (`dhl-api-developer-portal`). Deploy it alongside the other connectors of that app when they depend on each other (for example a token connector plus an API connector).

> [!NOTE]
>
> Not yet verified against the live vendor API: No own DHL credentials on the factory box (no DHL\_\* / MYDHL\_\* variables): no developer.dhl.com app key with the Tracking / Location Finder / Push / Parcel DE products, no MyDHL API username + password, no DHL Express account or Parcel DE billing number. Static, mock, negative-control and no / fake-credential public probes ran; DHL's public pre-defined test keys gave live 200s for TrackShipment (mocked data), Location Finder and the Parcel DE sandbox token + hello, but those demo keys have no shipping product (Parcel DE ValidateShipments 401 no apiproduct match; MyDHL rejects the portal demo key), so no authenticated GET + POST round trip of the shipping APIs and no broker MQTT round trip.

## Auth

Per product: DhlApi + DhlLocationFinder header DHL-API-Key (developer.dhl.com app key); MyDhlExpress HTTP Basic MyDHL username:password (from DHL Express, not the portal key) + x-version 3.3.3 + Message-Reference; DhlParcelDeAuth OAuth 2.0 password grant (form grant\_type=password, username, password = GKP system user, client\_id = API key, client\_secret = API secret; reply access\_token Bearer, expires\_in 1799, no refresh token); DhlParcelDe Authorization: Bearer only (bearer + dhl-api-key together -> 401). Every event sends User-Agent: Coreflux-Broker.

Auth headers used by the template: `DHL-API-Key: {value.json.api_key}`.

## Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Dhl Location Finder connector | no |
| `BaseUrl` | string | Dhl Location Finder base URL without trailing slash (e.g. [https://api.dhl.com](https://api.dhl.com)) | yes |

`BASE_ADDRESS` default: `https://api.dhl.com`.

## Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `FindLocationsByAddress` | GET | `/location-finder/v1/find-by-address?{value.json.query}` | `fleet/dhl/location/search` | `fleet/dhl/location/search/response` | `api_key`, `query` |
| `FindLocationsByGeo` | GET | `/location-finder/v1/find-by-geo?{value.json.query}` | `fleet/dhl/location-geo/search` | `fleet/dhl/location-geo/search/response` | `api_key`, `query` |
| `FindLocationsByKeywordId` | GET | `/location-finder/v1/find-by-keyword-id?{value.json.query}` | `fleet/dhl/location-keyword/search` | `fleet/dhl/location-keyword/search/response` | `api_key`, `query` |
| `GetLocation` | GET | `/location-finder/v1/locations/{value.json.id}` | `fleet/dhl/location/get` | `fleet/dhl/location/get/response` | `api_key`, `id` |

## Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode DHL_LOCATION_FINDER"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE DhlLocationFinder WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "https://api.dhl.com"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "true"
        WITH REQUEST_TIMEOUT '60'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT FindLocationsByAddress
        WITH SOURCE_TOPIC "fleet/dhl/location/search"
        WITH DESTINATION_TOPIC "fleet/dhl/location/search/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/location-finder/v1/find-by-address?{value.json.query}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "DHL-API-Key" "{value.json.api_key}"
    ADD EVENT FindLocationsByGeo
        WITH SOURCE_TOPIC "fleet/dhl/location-geo/search"
        WITH DESTINATION_TOPIC "fleet/dhl/location-geo/search/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/location-finder/v1/find-by-geo?{value.json.query}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "DHL-API-Key" "{value.json.api_key}"
    ADD EVENT FindLocationsByKeywordId
        WITH SOURCE_TOPIC "fleet/dhl/location-keyword/search"
        WITH DESTINATION_TOPIC "fleet/dhl/location-keyword/search/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/location-finder/v1/find-by-keyword-id?{value.json.query}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "DHL-API-Key" "{value.json.api_key}"
    ADD EVENT GetLocation
        WITH SOURCE_TOPIC "fleet/dhl/location/get"
        WITH DESTINATION_TOPIC "fleet/dhl/location/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/location-finder/v1/locations/{value.json.id}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "User-Agent" "Coreflux-Broker"
            ADD "DHL-API-Key" "{value.json.api_key}"
```

Deploy it with `-addRoute` (do not include `ADD METADATA`).

## Usage example

Call `FindLocationsByAddress` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'fleet/dhl/location/search/response' &
mosquitto_pub -t 'fleet/dhl/location/search' -m '{"api_key": "<api_key>", "query": "<query>"}'
```

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps catalog](/latest/lot-language/routes/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.