Todas las colecciones
Integración a PULPO WMS
Información general
Búsqueda general en la API de documentación
Búsqueda general en la API de documentación
V
Escrito por Victor Daniel
Actualizado hace más de una semana

Visión general

Esta descripción muestra algunas especificaciones de los puntos finales GET para la búsqueda de recursos. Normalmente, un endpoint de búsqueda en Pulpo WMS tiene la siguiente estructura

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

El resultado tiene la siguiente estructura:

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

muestra el número total de registros de la consulta.

Parámetro de consulta

Un parámetro de consulta puede ser:

  • Parámetros para la paginación

  • Parámetro de respuesta

  • Parámetro de atributo

  • Parámetros del filtro dinámico

Parámetros para la paginación

Por defecto, todos los puntos finales de búsqueda se paginan si no se establecen Limit y Offset como parámetros de consulta:

  • Si no se especifican Límite ni Offset, el valor de Límite es 10 y Offset es 0, y los resultados totales de la respuesta son la cantidad total de recursos.

  • Si el límite no es 0, total_results es cero.

Parámetros:

  • Límite

    • El límite determina el número de registros de datos que se muestran en la respuesta.

  • Offset

    • el offset establece el registro de recuento como primer elemento de la lista en la respuesta.

Parámetros de respuesta

Los parámetros de respuesta modifican la respuesta JSON.

Parámetros:

  • 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 }

Parámetro de atributo

Un parámetro de consulta puede ser un atributo del recurso y servir como filtro para el propio valor

Ejemplo:

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

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

Prefijos

Algunas operaciones pueden añadirse como prefijos para emparejar registros con atributos. Pulpo admite los siguientes prefijos:

  • 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

Parámetros de filtro dinámico

Un filtro dinámico agrupa varios parámetros de atributo y puede vincularse en grupos mediante una cláusula AND/OR. Como grupo de parámetros de atributo, los filtros dinámicos utilizan una nomenclatura estática para los valores.

  • 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

Parámetros:

  • __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

Atributos virtuales consultables

Existen algunos atributos virtuales que no forman parte de los recursos pero que están relacionados con ellos. Estos atributos especiales pueden añadirse como parámetros de consulta para ampliar la búsqueda con filtros dinámicos.

Los atributos virtuales consultables admitidos son:

  • 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

Puntos finales en open mode

Algunos puntos finales de la documentación de la API se especifican con las palabras " open mode " (modo abierto). Buscar en "open mode" significa que todos los parámetros de atributo incluidos como filtro actuarán como una cláusula OR, en otras palabras, la respuesta incluirá todos los registros que coincidan con cualquier filtro en los parámetros de la consulta.

Finales de búsqueda en modo abierto

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

Ejemplo

  • 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

¿Ha quedado contestada tu pregunta?