Acumatica REST API - 删除 SalesOrderDetail

Eth*_* H. 2 api rest acumatica

我正在尝试使用 REST API 删除特定的 SalesOrderDetail 记录(从 id 值)。

我看不到使用默认 API 的方法。我尝试自定义 Web 服务端点来为 SalesOrderDetail 创建顶级实体,以便我可以使用 DELETE 方法,但它似乎不起作用。

我还尝试向 SalesOrder 端点添加一个操作,该操作可以让我删除详细信息中的一行,但我无法使用该操作,而且我不确定如何访问它。

有谁知道如何做到这一点?

小智 6

您可以通过将明细实体的删除属性设置为 true 来删除项目的明细行。这可以通过任何端点完成,方法如下:

首先检索包含要删除的详细信息的记录:

GET : https://localhost/MyStoreInstance/entity/Default/18.200.001/SalesOrder ?$expand=Details&$select=OrderNbr,OrderType,Details/InventoryID,Details/ WarehouseID&$filter=OrderType eq 'SO' and CustomerOrder eq ' SO248-563-06'

你应该得到类似的结果:

[
    {
        "id": "c52bd7ac-c715-4ce3-8565-50463570b7d9",
        "rowNumber": 1,
        "note": "",
        "CustomerOrder": {
        "value": "SO248-563-06"
        },
        "Details": 
        [
            {
                "id": "988988a5-3bc0-4645-a884-8a9ba6a400b4",
                "rowNumber": 1,
                "note": "",
                "InventoryID": {
                "value": "AALEGO500"},
                "WarehouseID": {"value": "MAIN"},
                "custom": {},
                "files": []
            },
            {
                "id": "983f9831-b139-489c-8ad0-86d50f6e535d",
                "rowNumber": 2,
                "note": "",
                "InventoryID": {"value": "CONTABLE1"},
                "WarehouseID": {"value": "MAIN"},
                "custom": {},
                "files": []
            },
            {
                "id": "19193380-63b2-445c-a50b-fd6d57f176a0",
                "rowNumber": 3,
                "note": "",
                "InventoryID": {"value": "CONGRILL"},
                "WarehouseID": {"value": "MAIN"},
                "custom": {},
                "files": []
            }
        ],
        "OrderNbr": {"value": "000003"},
        "OrderType": {"value": "SO"},
        "custom": {},
        "files": []
    }
]
Run Code Online (Sandbox Code Playgroud)

然后,您可以使用以下正文重新发送 PUT 请求,以删除相应的详细信息行

{
    "OrderType":{"value":"SO"},
    "OrderNbr":{"value":"000003"},
    "Hold":{"value":false},
    "Details":
    [
        {
            "id":"19193380-63b2-445c-a50b-fd6d57f176a0",
            "delete":true
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)