Hier finden Sie einige Tipps und Anwendungsfälle, die Ihnen helfen, Ihre Anfragen und Aktionen mit unserer API zu setzen.
Um diese Anwendungsfälle zu veranschaulichen, haben wir uns für einen Testhändler entschieden.
- Nennen wir unseren Testhändler "Julia" und sagen, dass ihre Kontonummer "1" ist.
- Bitte beachten Sie, dass sie Postman verwendet, um alle ihre API-Aufrufe zu tätigen.
- Die Ergebnisse werden im JSON-Format sein
- Diese Anwendungsfälle sind reine Beispiele
Weitere Informationen über Postman und wie man eine Sammlung (Gruppe von gespeicherten Anfragen) erstellt hier.
Verbinden Sie sich mit unserer API: Zugangstoken erhalten
- Der erste Schritt, bevor Sie einen Anruf oder eine Aktion innerhalb der Lengow API machen, ist es, die API zu betreten.
- Die API sendet ein Zugangstoken zurück, wie dieses:
{
"token": "69946b78-edae-49b8-8874-6fb025e09a58",
"account_id": 1
}
Sie fügt dieses Token zu ihrer Postman-Umgebung unter der Variablen LENGOW_AUTH hinzu (siehe Bild unten).Aktionen auf Bestellungen prüfen
Julia hat eine ihrer Schiffaktionen auf einer Bestellung korrigiert. Sie möchte überprüfen, ob ihre letzte Aktion korrekt ist und ob die von ihr gesendete Aktion von der Lengow API zur API des Kanals korrekt verarbeitet wurde.
- GET /orders/actions/
-- Endpunkt /orders/actions --
-- GET-Methode --
GET /orders/actions/?account_id=1&marketplace_order_id=12-05319-12345
-- API-Antwort --
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 13244460,
"marketplace_order_id": "12-05319-123452",
"account_id": 1,
"marketplace": "ebay_fr",
"action_type": "ship",
"processed": true,
"queued": false,
"tracking_number": "2L01286914523",
"tracking_url": null,
"carrier": "FR_ColiposteColissimoRecommended",
"custom_carrier": null,
"line": "193393034918-1749999860009",
"declared_value": null,
"currency_code": null,
"invoice_number": null,
"shipping_method": null,
"shipping_date": null,
"shipping_service_id": null,
"shipping_service_offer_id": null,
"created_at": "2020-07-02T08:03:37.912433Z",
"updated_at": "2020-07-02T08:03:39.262053Z",
"weight": null,
"weight_unit": null,
"comment": null,
"delay": null,
"reason": null,
"charges": null,
"errors": null,
"delivery_date": null,
"delivery_experience": null,
"return_tracking_number": null,
"refund_price": null,
"refund_shipping_price": null,
"refund_mode": null,
"refund_reason": null,
"refund_quantity": null,
"refund_shipping": null,
"refund_shipping_taxes": null,
"refund_taxes": null,
"carrier_name": null,
"carrier_pickup": null,
"package_dimension_length": null,
"package_dimension_width": null,
"package_dimension_height": null,
"package_dimension_unit": null,
"from_address_name": null,
"from_address_line": null,
"from_address_city": null,
"from_address_state_province": null,
"from_address_postal_code": null,
"from_address_country_code": null,
"from_address_mail": null,
"from_address_phone": null,
"pickup_id": null,
"refund_id": null,
"return_carrier": null
},
{
"id": 13244455,
"marketplace_order_id": "12-05319-123452",
"account_id": 1,
"marketplace": "ebay_fr",
"action_type": "ship",
"processed": false,
"queued": false,
"tracking_number": null,
"tracking_url": null,
"carrier": "FR_ColiposteColissimoRecommended",
"custom_carrier": null,
"line": "193393034918-1749999860009",
"declared_value": null,
"currency_code": null,
"invoice_number": null,
"shipping_method": null,
"shipping_date": null,
"shipping_service_id": null,
"shipping_service_offer_id": null,
"created_at": "2020-07-02T08:02:50.609088Z",
"updated_at": "2020-07-02T08:02:50.681358Z",
"weight": null,
"weight_unit": null,
"comment": null,
"delay": null,
"reason": null,
"charges": null,
"errors": "Tracking needs number AND carrier for ship order action",
delivery_date": null,
"delivery_experience": null,
"return_tracking_number": null,
"refund_price": null,
"refund_shipping_price": null,
"refund_mode": null,
"refund_reason": null,
"refund_quantity": null,
"refund_shipping": null,
"refund_shipping_taxes": null,
"refund_taxes": null,
"carrier_name": null,
"carrier_pickup": null,
"package_dimension_length": null,
"package_dimension_width": null,
"package_dimension_height": null,
"package_dimension_unit": null,
"from_address_name": null,
"from_address_line": null,
"from_address_city": null,
"from_address_state_province": null,
"from_address_postal_code": null,
"from_address_country_code": null,
"from_address_mail": null,
"from_address_phone": null,
"pickup_id": null,
"refund_id": null,
"return_carrier": null
}
]
}
- API-Antwort
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
In den Ergebnissen sehen Sie, dass die Bestell-ID zweimal erscheint. Das bedeutet, dass der Server die gleiche Bestellung zweimal anzeigt, weil zwei Aktionen durchgeführt wurden. Die letzte Aktion wird oben in der Antwort angezeigt.
- "action_type"
- "processed"
- "queued"
- "error"
1/ Die erste "ship" Aktion, die Julia früher gesendet hat, ist nicht gültig weil wir in der API-Antwort sehen:
"processed": false
"error": "Tracking needs number AND carrier for ship order action"
Hier teilt die eBay API der Lengow's API mit, dass Julias "ship" Aktion unvollständig ist weil ein oder mehrere Parameter fehlen.
- Sie können sehen, dass der Parameter "tracking_number" in der ersten "ship" Aktion null ist.
- "processed": true
- "queued": false
- "error": null
Mehr Infos zu "queued" und "processed" Objekt hier.
Erhalten Sie Versandinformationen zu Bestellungen
Julia, unsere Testhändlerin, hat eine neue Bestellung vom Marktplatz La Redoute erhalten. Sie möchte die angeforderten Versandinformationen finden, um ihr bei der Versendung der Bestellung zu helfen.
GET /orders/?account_id=1&marketplace_order_id=2020.111.123456789
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"marketplace": "laredoute",
"account_id": 1,
"marketplace_country_iso2": "FR",
"marketplace_order_id": "2020.111.123456789",
"merchant_order_id": [
"1234567"
],
"marketplace_status": "ToShip",
"lengow_status": "waiting_shipment",
"workflow_rank": 5,
"marketplace_order_date": "2020-11-12T15:23:18Z",
"total_order": 74.8,
"total_tax": "0.00",
"shipping": 9.9,
"discount": 0.0,
"commission": null,
r>"processing_fee": null,
"currency": {
"iso_a3": "EUR",
"symbol": "€",
"name": "Euro"
},
"original_currency": {
"iso_a3": "EUR",
"symbol": "€",
"name": "Euro"
},
"original_total_order": 74.8,
"original_total_tax": "0.00",
"original_shipping": 9.9,
"original_discount": 0.0,
"original_commission": null,
"original_processing_fee": null,
"comments": null,
"invoice_number": null,
"invoice_url": null,
"payments": [],
"packages": [
{
"cart": [
{
"id": 8623271,
"marketplace_order_line_id": "2020.111.123456789-1",
"marketplace_product_id": "4001072020053",
"merchant_product_id": {
"field": "ID_PRODUCT",
"id": "111111"
},
"feed_id": 12345,
"marketplace_package_id": null,
"marketplace_status": "ToShip",
"lengow_status": "waiting_shipment",
"title": "Automatischer Diapositivbetrachter - Diascop 3",
"category": "Startseite > Zubehör > Betrachter",
"url_product": null,
"url_image": null,
"order_line_meta": {
"DeliveryMode": "Home",
"DeliveryType": "Regular"
},
"amount": "64.90",
"tax": "0.00",
"discount": null,
"shipping": null,
"original_amount": "64.90",
"original_tax": "0.00",
"original_discount": null,
"original_shipping": null,
"quantity": 1,
"documents": [],
"created_at": null,
"updated_at": null,
"orderline_types": []
}
],
"delivery": {
"id": 151186892,
"type": "delivery",
"first_line": "500 AVENUE TEST",
"zipcode": "69300",
"city": "CALUIRE ET CUIRE",
"vat_number": null,
"company": null,
"civility": "Herr",
"first_name": null,
"last_name": null,
"second_line": "",
"complement": "3. STOCK",
"phone_home": null,
"phone_office": null,
"phone_mobile": "06700000000",
"full_address": null,
"full_name": "TEST BOB DUPONT",
"email": "*****.fr",
"metas": null,
"state_region": null,
"common_country_iso_a2": "FR",
"trackings": [
{
"number": null,
"method": "Home / Regular",
"carrier": null,
"url": null,
"is_delivered_by_marketplace": null,
"parcel_weight": null,
"shipped_at": null,
"pickup_store": {
"id": null
},
"relay": {
"id": null,
"name": null
},
"marketplace_order_line_ids": [
"2020.111.123456789-1"
]
}
]
}
}
],
"billing_address": {
"id": 151198390,
"type": "billing",
"first_line": "500 AVENUE TEST",
"zipcode": "69300",
"city": "CALUIRE ET CUIRE",
"vat_number": null,
"company": null,
"civility": "Herr",
"first_name": null,
"last_name": null,
"second_line": "",
"complement": "3. STOCK",
"phone_home": null,
"phone_office": null,
"phone_mobile": "06700000000",
"full_address": null,
"full_name": "TEST BOB DUPONT",
"email": "*****.fr",
"metas": null,
"state_region": null,
"common_country_iso_a2": "FR"
},
"contact_address": null,
"documents": [],
"imported_at": "2020-11-12T16:09:07.256186Z",
"updated_at": "2020-11-12T16:32:15.849000Z",
"order_meta": {
"checksum": "b4aa946ef504ed758359db880c03bd62"
},
"anonymized": false,
"order_types": []
}
]
}
- Die Bestellung befindet sich im Status "waiting_shipment".
- "method": "Home / Regular"
Hinweis: Wenn die Methode "Relais / Regular" gewählt worden wäre, wäre der "relay" Parameter der Bestellung mit einer Kennung und einem Namen des Relay-Punktes ausgefüllt worden.
SCHRITT 2
GET /marketplaces/?marketplace=laredoute
In der Antwort, die die Lengow API zurückgibt, könnte sie finden
- Liste der Bestellstatus
- Erlaubte Aktionen auf Bestellungen und obligatorische Parameter zum Ausfüllen pro Aktion
- Vom Marktplatz in der "carriers" Tag autorisierte Spediteure
"actions": {
"ship": {
"args": [
"carrier",
strong> "tracking_number"
],
"carrier": {
"type": "string",
"valid_values": {},
"default_value": "",
"accept_free_values": true
- die "carrier"-Information
- eine "tracking_number"
Da es keine Liste obligatorischer Carrier gibt, kann sie den Carrier ihrer Wahl verwenden.
Dokumente abrufen
Julia, unsere Testhändlerin, hat eine neue Bestellung vom Zalando-Marktplatz erhalten. Sie möchte die Dokumente herunterladen, die sie dem Paket beilegen soll: Rechnung, Lieferschein und Rücksendeformular.
Hinweis: Diese Dokumente werden von Lengow bearbeitet und können auch auf der Lengow-Plattform heruntergeladen werden, wie in unserem Zalando-Leitfaden erklärt.
SCHRITT 1
Sobald sie mit der Lengow-API verbunden ist, fragt sie ihre Bestellung mit dem /orders-Endpunkt so ab:
GET /orders/?account_id=1&marketplace_order_id=10987654321
In der Antwort, die die Lengow-API zurückgibt, findet sie den Abschnitt "Dokumente", wo sie die IDs dieser Dokumente erhalten kann:
"documents": [
{
"id": 2111112,
"marketplace_doc_id": "DELIVERY_NOTE_123fc456-f789-101b-b12g-a134c1235678",
"url": "http://api.lengow.io/v3.0/document/2111112",
"created_at": "2022-05-14T06:26:19.479581Z",
"doc_type": {
"lengow_type": "DELIVERY",
"marketplace_code": "DELIVERY_NOTE",
"marketplace_label": "Zalando Liefernotizen"
}
},
{
"id": 2111111,
"marketplace_doc_id": "RETURN_123fc456-f789-101b-b12g-a134c1235678",
"url": "http://api.lengow.io/v3.0/document/2111111",
"created_at": "2022-05-14T06:26:19.478343Z",
"doc_type": {
"lengow_type": "RETURN",
"marketplace_code": "RETURN",
"marketplace_label": "Zalando Rücksendeformular"
}
},
{
"id": 2111110,
"marketplace_doc_id": "BILL_123fc456-f789-101b-b12g-a134c1235678",
"url": "http://api.lengow.io/v3.0/document/2111110",
"created_at": "2022-05-14T06:26:19.475280Z",
"doc_type": {
"lengow_type": "BILL",
"marketplace_code": "BILL",
"marketplace_label": "Zalando Rechnung"
}
}
]
SCHRITT 2
Mit den gefundenen Dokumenten-IDs (2111110, 2111111 und 2111112 in diesem Beispiel) lädt Julia die entsprechenden Dokumente mit dem /document-Endpunkt herunter (ein Aufruf für jedes Dokument):
GET /document/2111110?account_id=1
Ergebnis wie in Postman sichtbar:
Kommentare
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.