我相信您需要将查询设置为也返回格式化的值。
要求:
GET [Organization URI]/api/data/v8.1/accounts?$select=name,donotpostalmail,accountratingcode,numberofemployees,revenue&$top=1 HTTP/1.1
Accept: application/json
OData-MaxVersion: 4.0
OData-Version: 4.0
Prefer: odata.include-annotations="OData.Community.Display.V1.FormattedValue"
结果:
HTTP/1.1 200 OK
Content-Type: application/json; odata.metadata=minimal
OData-Version: 4.0
Preference-Applied: odata.include-annotations="OData.Community.Display.V1.FormattedValue"
{
"@odata.context": "[Organization URI]/api/data/v8.1/$metadata#accounts(name,donotpostalmail,accountratingcode,numberofemployees,revenue)",
"value": [
{
"@odata.etag": "W/"502170"",
"name": "Fourth Coffee (sample)",
"donotpostalmail@OData.Community.Display.V1.FormattedValue": "Allow",
"donotpostalmail": false,
"accountratingcode@OData.Community.Display.V1.FormattedValue": "Default Value",
"accountratingcode": 1,
"numberofemployees@OData.Community.Display.V1.FormattedValue": "9,500",
"numberofemployees": 9500,
"revenue@OData.Community.Display.V1.FormattedValue": "$100,000.00",
"revenue": 100000,
"accountid": "89390c24-9c72-e511-80d4-00155d2a68d1",
"transactioncurrencyid_value": "50b6dd7b-f16d-e511-80d0-00155db07cb1" } ]
}
来源:包括格式化的值