【问题标题】:Why Does Calling Expand and Select on a PUT result in LESS information being returned - Acumatica REST API为什么在 PUT 上调用 Expand 和 Select 会导致返回 LESS 信息 - Acumatica REST API
【发布时间】:2020-02-20 17:03:13
【问题描述】:

Acumatica 的示例中:“第 2.1 课:更新客户帐户” 示例代码将根据通过电子邮件地址检索客户的联系信息来更新它.它展开 MainContact 并选择 CustomerID 和 CustomerClass:

https://localhost/MyStoreInstance/entity/Default/18.200.001/Customer?$filter=MainContact/Email eq 'info@jevy-comp.con'&$expand=MainContact&$select=CustomerID,CustomerClass

返回的值包括 CustomerID、CustomerClass 加上一个完全加载的 BillingContact 记录,包括 2150 字节的数据,如下所示:

{
    "id": "0b88d208-297a-4b81-a20c-39d27bace10a",
    "rowNumber": 1,
    "note": "",
    "BillingContact": {
        "id": "e1133b8a-fca9-4885-8e4c-09a85808f025",
        "rowNumber": 1,
        "note": null,
        "Activities": [],
        "Address": {
            "id": "4f1719aa-6eb0-4551-a143-ad2139e135aa",
            "rowNumber": 1,
            "note": null,
            "AddressLine1": {
                "value": "1000 Pennsylvania Ave"
            },
            "AddressLine2": {},
            "City": {
                "value": "San Francisco"
            },
            "Country": {
                "value": "US"
            },
            "PostalCode": {
                "value": "94107-3479"
            },
            "State": {
                "value": "CA"
            },
            "custom": {},
            "files": []
        },
        "Attention": {
            "value": "Mister. Jack Green"
        },
        "Attributes": [],
        "Campaigns": [],
        "Cases": [],
        "ContactID": {
            "value": 12417
        },
        "DisplayName": {
            "value": "Jevy Computers"
        },
        "Duplicates": [],
        "Email": {
            "value": "green@jevy-comp.con"
        },
        "Fax": {},
        "FirstName": {},
        "JobTitle": {
            "value": ""
        },
        "LastName": {},
        "MarketingLists": [],
        "MiddleName": {},
        "Notifications": [],
        "Opportunities": [],
        "Phone1": {
            "value": "+1 (777) 380-0089"
        },
        "Phone1Type": {
            "value": "Business 1"
        },
        "Phone2": {},
        "Phone2Type": {
            "value": "Business 2"
        },
        "Relations": [],
        "Title": {},
        "UserInfo": null,
        "WebSite": {},
        "custom": {},
        "files": []
    },
    "BillingContactSameAsMain": {
        "value": false
    },
    "CustomerClass": {
        "value": "INTL"
    },
    "CustomerID": {
        "value": "C000000003"
    },
    "custom": {},
    "files": []
}

但是,当我明确要求将 BillingContact扩展 时,我得到的信息比我从 EXPAND 命令中完全省略它时得到的信息少。 (我得到 1235 个字节作为回报。)

{
    "id": "0b88d208-297a-4b81-a20c-39d27bace10a",
    "rowNumber": 1,
    "note": "",
    "BillingContact": {
        "id": "e1133b8a-fca9-4885-8e4c-09a85808f025",
        "rowNumber": 1,
        "note": null,
        "Attention": {
            "value": "Mr. Jack Green"
        },
        "ContactID": {
            "value": 12417
        },
        "DisplayName": {
            "value": "Jevy Computers"
        },
        "Email": {
            "value": "green@jevy-comp.con"
        },
        "Fax": {},
        "FirstName": {},
        "JobTitle": {
            "value": ""
        },
        "LastName": {},
        "MiddleName": {},
        "Phone1": {
            "value": "+1 (777) 380-0089"
        },
        "Phone1Type": {
            "value": "Business 1"
        },
        "Phone2": {},
        "Phone2Type": {
            "value": "Business 2"
        },
        "Title": {},
        "WebSite": {},
        "custom": {},
        "files": []
    },
    "BillingContactSameAsMain": {
        "value": false
    },
    "CustomerClass": {
        "value": "INTL"
    },
    "CustomerID": {
        "value": "C000000003"
    },
    "custom": {},
    "files": []
}

显然,我不明白 expand 命令在 PUT 中是如何运行的。谁能给我解释一下?

为什么在 expand 命令中包含 BillingContact 会给我less BillingContact 信息?

【问题讨论】:

    标签: acumatica acumatica-kb


    【解决方案1】:

    当您执行 Put 请求时,Acumatica 会自动为您正在触摸的实体添加展开,包括子实体,因此您会在 BillingContact 下看到地址。 当您在计费联系人上添加扩展时,它会覆盖默认扩展并且您不会再看到 Address。 要在结果中获得Address,请添加另一个扩展:BillingContact/Address

    同样适用于所有其他实体

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-01-09
      • 2014-10-30
      • 1970-01-01
      • 1970-01-01
      • 2018-02-26
      • 1970-01-01
      • 2016-12-22
      相关资源
      最近更新 更多