tripletex-api2 icon indicating copy to clipboard operation
tripletex-api2 copied to clipboard

Buggy POST /v2/inventory/stocktaking/productline/list

Open chrisbbe opened this issue 1 year ago • 1 comments

While implementing stock-taking using the API we encountered a bug in the API.

Field count and location.id has no effect when issuing POST /v2/inventory/stocktaking/productline/list

POST /v2/inventory/stocktaking/productline/list
[
    {
        "stocktaking": {
            "id": 1040
        },
        "product": {
            "id": 21494313
        },
        "location": {
            "id": 13
        },
        "count": 5
    }
]

response payload:

{
    "fullResultSize": 0,
    "from": 0,
    "count": 1,
    "versionDigest": null,
    "values": [
        {
            "id": 1412118,
            "version": 0,
            "url": "api.tripletex.io/v2/inventory/stocktaking/productline/1412118",
            "stocktaking": {
                "id": 1040,
                "url": "api.tripletex.io/v2/inventory/stocktaking/1040"
            },
            "product": {
                "id": 21494313,
                "url": "api.tripletex.io/v2/product/21494313"
            },
            "count": 0,
            "unitCostCurrency": 0,
            "costCurrency": 0.00,
            "comment": "",
            "counted": false,
            "counter": null,
            "dateCounted": null,
            "expectedStock": 0,
            "location": null
        }
    ]
}

as count is 0 and location is null in the response.

One could work around this in a less performant way by issuing a single POST for each line to add:

POST /v2/inventory/stocktaking/productline
{
    "stocktaking": {
        "id": 1040
    },
    "product": {
        "id": 21494313
    },
    "location": {
        "id": 13
    },
    "count": 5
}

response payload:

{
    "value": {
        "url": "api.tripletex.io/v2/inventory/stocktaking/productline/0"
    }
}

in this request, the field count is working, but location.id does not. Since response payload nor headers do not contain the ID of the line added, one could not go further by issuing PUT /v2/inventory/stocktaking/productline/{ID}/:changeLocation?warehouseLocationId=39 to update the location on the line.

chrisbbe avatar Apr 11 '24 12:04 chrisbbe

Hello @chrisbbe Thank you for reporting this. We manage to reproduce this issue and we created an internal jira ticket for this. We will keep you updated.

andreeasondavisma avatar Apr 12 '24 13:04 andreeasondavisma