Acumatica REST API-删除SalesOrderDetail

时间:2019-02-22 20:09:18

标签: rest api acumatica

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

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

我还尝试将操作添加到SalesOrder端点,该操作使我可以删除详细信息中的一行,但是该操作不可用,我不确定如何访问它。

有人知道该怎么做吗?

1 个答案:

答案 0 :(得分:2)

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

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

GET:https://localhost/MyStoreInstance/entity/Default/18.200.001/SalesOrder?$ expand = Details&$ select = OrderNbr,OrderType,Details / InventoryID,Details / WarehouseID&$ filter = OrderType eq'SO'和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": []
    }
]

然后您可以重新发送带有以下正文的PUT请求,以删除相应的明细行

{
    "OrderType":{"value":"SO"},
    "OrderNbr":{"value":"000003"},
    "Hold":{"value":false},
    "Details":
    [
        {
            "id":"19193380-63b2-445c-a50b-fd6d57f176a0",
            "delete":true
        }
    ]
}