postnl / postnl-magento2

This is the official Magento 2 extension for the logistics company PostNL. Add shipping options and parcelshops to your checkout. Create labels with track and trace functionality from the backend.
58 stars 61 forks source link

[BUG] shipment labels search returns empty arrays instead of objects #378

Closed memen45 closed 7 months ago

memen45 commented 7 months ago

To Reproduce Steps to reproduce the behavior:

  1. make a GET request to the shipment labels search endpoint /V1/postnl/shipments/label/search (described here) with the searchcriteria object in the query as usual (note the unusual use of 'criteria' instead of 'searchCriteria'):
    criteria[pageSize]: 10
    criteria[currentPage]: 1
    criteria[sortOrders][0][field]: entity_id
    criteria[sortOrders][0][direction]: DESC
    criteria[filterGroups][0][filters][0][conditionType]: eq
    criteria[filterGroups][0][filters][0][field]: product_code
    criteria[filterGroups][0][filters][0][value]: 4946

Expected result The response should contain a json with the items element set to an array of items. Example:

{
    "items": [
        { "entity_id": "21", .... etc etc },
        { "entity_id": "22", .... etc etc },
        { "entity_id": "23", .... etc etc },
    ],
    "search_criteria": {
        "filter_groups": [
            {
                "filters": [
                    {
                        "field": "product_code",
                        "value": "4946",
                        "condition_type": "eq"
                    }
                ]
            }
        ],
        "sort_orders": [
            {
                "field": "entity_id",
                "direction": "DESC"
            }
        ],
        "page_size": 10,
        "current_page": 1
    },
    "total_count": 3
}

Actual result The response contains empty arrays for each of the items that were found. Example:

{
    "items": [
        [],
        [],
        []
    ],
    "search_criteria": {
        "filter_groups": [
            {
                "filters": [
                    {
                        "field": "product_code",
                        "value": "4946",
                        "condition_type": "eq"
                    }
                ]
            }
        ],
        "sort_orders": [
            {
                "field": "entity_id",
                "direction": "DESC"
            }
        ],
        "page_size": 10,
        "current_page": 1
    },
    "total_count": 3
}

Workaround None

Please complete the following information

JorisPostNL commented 7 months ago

Hello @memen45, thank you for bringing this to our attention. We have developed a fix for this issue which we will release as soon as possible

Kind regards Joris PostNL Support