为什么在 PUT 上调用 Expand 和 Select 会导致返回的信息较少 - Acumatica REST API
Why Does Calling Expand and Select on a PUT result in LESS information being returned - Acumatica REST API
在 Acumatica 的示例中:"Lesson 2.1: Updating a Customer Account" 示例代码将根据检索更新客户的联系信息通过电子邮件地址。它展开 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
returned 的值包括 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": []
}
但是,当我明确要求 Expanded 时,我得到的信息比我从 EXPAND 命令中完全省略它时得到的信息少。 (我在 return 中得到 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 信息?
当您执行 Put 请求时,Acumatica 会自动为您正在触摸的实体添加扩展,包括子实体,因此您会在 BillingContact
下看到地址。
当您在帐单联系人上添加扩展时,它会覆盖默认扩展并且您不会再看到 Address
。
要在结果中获得 Address
,您添加另一个展开:BillingContact/Address
同样适用于所有其他实体
在 Acumatica 的示例中:"Lesson 2.1: Updating a Customer Account" 示例代码将根据检索更新客户的联系信息通过电子邮件地址。它展开 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
{
"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": []
}
但是,当我明确要求 Expanded 时,我得到的信息比我从 EXPAND 命令中完全省略它时得到的信息少。 (我在 return 中得到 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 信息?
当您执行 Put 请求时,Acumatica 会自动为您正在触摸的实体添加扩展,包括子实体,因此您会在 BillingContact
下看到地址。
当您在帐单联系人上添加扩展时,它会覆盖默认扩展并且您不会再看到 Address
。
要在结果中获得 Address
,您添加另一个展开:BillingContact/Address
同样适用于所有其他实体