Skip to content

Latest commit

Β 

History

History
134 lines (113 loc) Β· 4.1 KB

File metadata and controls

134 lines (113 loc) Β· 4.1 KB
title Quick Start
description Create your first GLS shipment in a few steps.

Quick Start

This guide walks you through creating your first GLS shipment using the GLS Action. By the end, you will have a working flow that creates a parcel and retrieves a shipping label.


Step 1: Install and configure the action

Follow the Installation Guide to deploy the GLS Action, then set the following configuration values in your Hercules admin panel (or .env file):

Config Value
client_id Your GLS OAuth2 client ID
client_secret Your GLS OAuth2 client secret
ship_it_api_url GLS ShipIT endpoint (default: https://api.gls-group.net/shipit-farm/v1/backend/rs)
auth_url GLS auth endpoint (default: https://api.gls-group.net/oauth2/v2/token)

See Configuration for the full list of options and how to obtain credentials.


Step 2: Build your flow

A basic "create a GLS parcel" flow looks like this:

[createAddress]          β†’ GLS_ADDRESS (recipient)
[createAddress]          β†’ GLS_ADDRESS (shipper)
[createShipmentUnit]     β†’ GLS_SHIPMENT_UNIT
[createPrintingOptions]  β†’ GLS_PRINTING_OPTIONS
[createShopDeliveryShipment] β†’ GLS_CREATE_PARCELS_RESPONSE

Flow diagram

START
  β”‚
  β”œβ”€ createAddress (recipient)
  β”‚     Name1: "John Doe"
  β”‚     CountryCode: "DE"
  β”‚     City: "Munich"
  β”‚     Street: "Musterstrasse"
  β”‚     ZIPCode: "80331"
  β”‚         β”‚
  β”‚         β–Ό GLS_ADDRESS (recipient)
  β”‚
  β”œβ”€ createAddress (shipper)
  β”‚     Name1: "My Company GmbH"
  β”‚     CountryCode: "DE"
  β”‚     City: "Berlin"
  β”‚     Street: "Hauptstrasse"
  β”‚     ZIPCode: "10115"
  β”‚         β”‚
  β”‚         β–Ό GLS_ADDRESS (shipper)
  β”‚
  β”œβ”€ createShipmentUnit
  β”‚     weight: 2.5
  β”‚         β”‚
  β”‚         β–Ό GLS_SHIPMENT_UNIT
  β”‚
  β”œβ”€ createPrintingOptions
  β”‚     returnLabels:
  β”‚       TemplateSet: "NONE"
  β”‚       LabelFormat: "PDF"
  β”‚         β”‚
  β”‚         β–Ό GLS_PRINTING_OPTIONS
  β”‚
  └─ createShopDeliveryShipment
        parcelShopId: "12345"
        shipment:
          Product: "PARCEL"
          Consignee: { Address: <recipient address> }
          Shipper: { Address: <shipper address> }
          ShipmentUnit: [<shipment unit>]
        printingOptions: <printing options>
            β”‚
            β–Ό GLS_CREATE_PARCELS_RESPONSE
              { CreatedShipment: { TrackID, PrintData, ... } }

Step 3: Use the response

The GLS_CREATE_PARCELS_RESPONSE contains everything you need:

{
  "CreatedShipment": {
    "ShipmentReference": ["REF-001"],
    "ParcelData": [
      {
        "TrackID": "12345678",
        "ParcelNumber": "00123456789",
        "Barcodes": {
          "Primary2D": "...",
          "Secondary2D": "...",
          "Primary1D": "..."
        },
        "RoutingInfo": {
          "Tour": "MUC-01",
          "FinalLocationCode": "MUC",
          "HubLocation": "MUC-HUB"
        }
      }
    ],
    "PrintData": [
      {
        "Data": "<base64-encoded-pdf>",
        "LabelFormat": "PDF"
      }
    ]
  }
}
  • TrackID β€” Use this to track the parcel or cancel the shipment later
  • PrintData[].Data β€” Base64-encoded shipping label, decode and print it
  • RoutingInfo β€” Routing information assigned by GLS

Common next steps