Alle Kollektionen
PULPO WMS Integrationen
Allgemeine Integration
Allgemeiner Suchleitfaden in API-Ressourcen
Allgemeiner Suchleitfaden in API-Ressourcen
V
Verfasst von Victor Daniel
Vor über einer Woche aktualisiert

Übersicht

Dieser Leitfaden zeigt einige Spezifikationen für GET-Endpunkte zur Suche von Ressourcen. Normalerweise hat ein Suchendpunkt in Pulpo WMS die folgende Struktur

GET pulpo.co/api/v1/resource ? query_param1=value1 & query_param2=value2 & limit=100 & offset=0

Das Ergebnis hat die folgende Struktur:

1 {
2 "resource": [
3 {
4 "attribute1": "value",
5 "another_attribute": "another_value"
6 }
7 ],
8 "total_results": 1
9 }
total_results

zeigt die Gesamtzahl der Datensätze in der Abfrage an.

Abfrageparameter

Ein Abfrageparameter könnte sein:

  • Parameter für die Paginierung

  • Antwort-Parameter

  • Attribut-Parameter

  • Parameter für den dinamischen Filter

Parameter für die Paginierung

Standardmäßig werden alle Suchendpunkte paginiert, wenn Limit und Offset nicht als Abfrageparameter festgelegt sind:

  • Wenn Limit oder Offset nicht angegeben werden, ist der Wert für Limit 10 und Offset 0, und die Gesamtergebnisse in der Antwort sind die Gesamtmenge der Ressourcen.

  • Wenn der Grenzwert nicht 0 ist, ist total_results gleich Null.

Parameter:

  • Limit

    • das Limit legt die Anzahl der Datensätze fest, die in der Antwort angezeigt werden

  • Offset

    • der Offset legt den Zähldatensatz als erstes Element der Liste in der Antwort fest

Antwort-Parameter

Die Antwortparameter modifizieren die JSON-Antwort

Parameter:

  • sort_by - The result of the query will be sorted by the specified attribute in the resource.

    • Support asc and desc as prefix

    • Example GET all products and sort by sku /api/v1/inventory/products ? sort_by=sku:asc

  • view_attributes - Specifies the fields to be shown in the response

    • Syntax: the attributes should be separated by a comma

      • view_attributes=attr1,attr2,attr3

    • Endpoints: Only the following endpoints support view_attributes

      • search packing orders GET /api/v1/packing/orders

      • search picking orders GET /api/v1/picking/orders

      • search sales orders GET /api/v1/sales/orders

    • Example GET all packing orders but only show sequence_number, id, and state in the response

      • /api/v1/packing/orders ? view_attributes=sequence_number,id,state

1 {
2 "packing_orders": [
3 {
4 "id": 23486,
5 "sequence_number": "PA-0000015",
6 "state": "closed"
7 },
8 {
9 "id": 23423,
10 "sequence_number": "PA-0000010",
11 "state": "queue"
12 },
13 {
14 "id": 23483,
15 "sequence_number": "PA-0000012",
16 "state": "closed"
17 }
18 ],
19 "total_results": 52
20 }

Attribut-Parameter

Ein Abfrageparameter kann ein Attribut der Ressource sein und als Filter für den Wert selbst dienen

Beispiel:

  • GET all products which the sku matches with “1734“

    • GET /api/v1/inventory/products ? sku=1734

Präfixe

Einige Operationen können als Präfixe hinzugefügt werden, um die Datensätze mit Attributen abzugleichen. Die folgenden Präfixe werden von Pulpo unterstützt:

  • to_list - Filters the parameter by the match within a provided list of values. It behaves like IN clause

    • Example

      • GET all products which the sku matches with the list “1734“, “1735”, “1736”

        • GET /api/v1/inventory/products ? sku=to_list:1734,1735,1736

  • gt - filters the attribute to a value greater than the specified number value

    • Example

      • GET all products which unit per sales package greater than 2

        • GET /api/v1/inventory/products ? unit_per_sales_package=gt:2

  • gte - filters the attribute to a value greater than or equal to the specified number value

    • Example

      • GET all products which unit per sales package greater or equal than 2

        • GET /api/v1/inventory/products ? unit_per_sales_package=gte:2

  • lt - filters the attribute to a value lower than the specified number value

    • Example: GET all products which unit per sales package lower than 2

      • GET /api/v1/inventory/products ? unit_per_sales_package=lt:2

  • lte - filters the attribute to a value lower than or equal to the specified number value

    • Example: GET all products which unit per sales package lower or equal than 2

      • GET /api/v1/inventory/products ? unit_per_sales_package=lte:2

  • between - filters the attributes to a specified range of numeric values,

    • Example: GET all products which unit per sales package lower between 3 and 6

      • GET /api/v1/inventory/products ? unit_per_sales_package=between:3,6

  • contains - filters the attribute to a record that contains the text specified in the value

    • Example: GET all third parties which name contains Doe

      • GET /api/v1/iam/third_parties ? name=contains:Doe

  • starts_with - filters the attribute to a record that starts with the text specified in value

    • GET all third parties which name starts with John

      • GET /api/v1/iam/third_parties ? name=starts_with:John

  • ends_with - filter the attribute to a record that ends with the text specified in the value

    • Example: GET all third parties which name starts with Doe

      • GET /api/v1/iam/third_parties ? name=ends_with:Doe

  • like - filter the attribute to a record that contains the text specified in the value

    • Example: GET all third parties which identifier number is like 7777

      • GET /api/v1/iam/third_parties ? identifier_number=like:77777

Dynamische Filterparameter

Ein dynamischer Filter gruppiert mehrere Attributparameter und kann durch eine AND/OR-Klausel gruppenweise verknüpft werden. Als Gruppe von Attributparametern verwenden dynamische Filter eine statische Nomenklatur für die Werte.

  • The number of parameters and a number of values provided in the group should match exactly. E.G. ?__search=param_1,param2|value_1 will raise an exception due 2 parameters were provided and just only 1 value

Parameter:

  • __search - Group all static filters in the group with AND clauses. The whole group joins WHERE clause with AND clause.

    • Example for GET all movements with state queue and type manual

    • GET api/v1/replenishment/orders ? __search=state,type|queue,manual

  • __or_search - Group all static filters in the group with OR clauses. The whole group joins WHERE clause with OR clause

    • Example GET all movements with state queue or type manual

      • GET api/v1/replenishment/orders ? __or_search=state,type|queue,manual

Abfragbare virtuelle Attribute

Es gibt einige virtuelle Attribute, die nicht Teil der Ressourcen sind, aber mit ihnen in Verbindung stehen. Diese speziellen Attribute können als Abfrageparameter hinzugefügt werden, um die Suche mit dynamischen Filtern zu erweitern.

Die unterstützten abfragbaren virtuellen Attribute sind:

  • counter_name in counting task resource

  • event_status in event log resource

  • event_type in event log resource

  • owner_name in incoming goods

  • priority in picking order resource

  • product_name in stock thresholds resource

  • product_sku in stock thresholds resource

  • owner_name in replenishment orders

  • cart_box_barcode in packing order resource

  • duration in packing order resource

  • sales_order_num in packing order resource

  • origin_location_code in packing order resource

  • owner_name in packing order resource

  • third_party_name in packing order resource

  • third_party_name in purchase order resource

  • third_party_name in sales order resource

  • shipping_method_name in sales order resource

  • sales_order_num in shipping order resource

  • shipping_location_code in shipping order resource

  • third_party_id in shipping order resource

  • third_party_name in shipping order resource

Example: GET all packing orders performed by user “John Doe”

GET api/v1/packing/orders ? __search=owner_name|John Doe

Endpunkte im "Open Mode"

Einige Endpunkte werden in der API-Dokumentation mit den Worten " Open Mode" angegeben. Suche im "Open Mode" bedeutet, dass alle Attributsparameter, die als Filter enthalten sind, als ODER-Klausel fungieren, d. h. die Antwort enthält jeden Datensatz, der mit einem beliebigen Filter in den Abfrageparametern übereinstimmt.

Endpunkte in open-mode suche

  • Search products in open mode GET /inventory/products/open

Beispiel

GET all products which the name matches with “product_a” or matches with sku “p1234“

  • GET /api/v1/inventory/products/open ? sku=p1234 & name=product_a

Hat dies Ihre Frage beantwortet?