如何查询所有现有字段的元数据 [英] How to query metadata for all existing fields
本文介绍了如何查询所有现有字段的元数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们希望使客户端能够发布到以下端点:
We want to enable the client to post to an endpoint such as:
[Route("Account", Name = "CreateAccount", Order = 1)]
[HttpPost]
public Account CreateAccount([FromBody] Account account)
{
var newAccount = _accountService.CreateAccountEntity(account);
return newAccount;
}
我们知道可以做到:>
We know that this can be done:
POST [Organization URI]/api/data/v8.2/accounts HTTP/1.1
Content-Type: application/json; charset=utf-8
OData-MaxVersion: 4.0
OData-Version: 4.0
Accept: application/json
{
"name": "Sample Account",
"creditonhold": false,
"address1_latitude": 47.639583,
"description": "This is the description of the sample account",
"revenue": 5000000,
"accountcategorycode": 1
}
我们如何向消费者公开每个帖子/put的要求?
用不同的措辞表述,如果我需要使用CRM 2016提供的Web API更新自定义或基本实体上的记录,我如何知道创建或更新实体需要哪些字段?
修改: 我已经尝试过Hank的方法,但是并没有在实体上返回任何元数据:
I've attempted Hank's approach, and this didn't return any metadata on the entity:
推荐答案
您可以使用WebApi端点查询Dynamics 365元数据,如
You can query the Dynamics 365 metadata using the WebApi endpoint, as shown in the SDK.
例如,要检索account
实体的所有属性(包括需求级别):
For example, to retrieve all the attributes (which includes the requirement level) for account
entity:
GET [Organization URI]/api/data/v8.2/EntityDefinitions(LogicalName='account')/Attributes HTTP/1.1
OData-MaxVersion: 4.0
OData-Version: 4.0
Accept: application/json
Content-Type: application/json; charset=utf-8
这篇关于如何查询所有现有字段的元数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文