fetchXML 简单帐户检索
fetchXML simple account retrieve
我正在尝试使用简单查询 provided here
对我的帐户列表执行 fetchXML 查询
通常情况下,我希望这会在我 运行 查询的帐户旁边用 json 响应来响应,但我却收到此错误消息:
The request URI is not valid. Since the segment 'accounts' refers to a collection, this must be the last segment in the request URI or it must be followed by an function or action that can be bound to it otherwise all intermediate segments must refer to a single resource.
我的实际 URL 请求是:
https://<org>.crm.dynamics.com/api/data/v9.0/accounts(<actual_guid>)
我是不是忽略了什么?我最初有一个更复杂的 fetchXML 请求,但尽可能简单以消除可能的问题。
在此先感谢您的帮助!
如果你想对 Web API 端点执行 FetchXML 查询,正确的语法是这个(jQuery 示例,但你可以看到端点 url):
var originalFetchXML = '<fetch top="5" ><entity name="account" ><attribute name="accountid" /><attribute name="name" /></entity></fetch>';
var escapedFetchXML = encodeURIComponent(originalFetchXML);
$.ajax({
type: "GET",
url: Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.1/accounts?fetchXml=" + escapedFetchXML,
async: true,
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Content-Type": "application/json; charset=utf-8",
"Accept": "application/json",
"Prefer": "odata.include-annotations=*"
},
success: function (data, textStatus, xhr) {
var results = data;
console.log(results);
},
error: function (xhr, textStatus, errorThrown) {
console.log(xhr);
}
});
您没有写出执行查询所使用的确切语言,但如果是 JavaScript (Xrm.WebApi、Fetch API、jQuery 或 XHR ) 你可以使用Dataverse REST Builder来生成它,执行Fetch XML是在Predefined Query
请求类型和Query Type
作为FetchXML
我正在尝试使用简单查询 provided here
对我的帐户列表执行 fetchXML 查询通常情况下,我希望这会在我 运行 查询的帐户旁边用 json 响应来响应,但我却收到此错误消息:
The request URI is not valid. Since the segment 'accounts' refers to a collection, this must be the last segment in the request URI or it must be followed by an function or action that can be bound to it otherwise all intermediate segments must refer to a single resource.
我的实际 URL 请求是:
https://<org>.crm.dynamics.com/api/data/v9.0/accounts(<actual_guid>)
我是不是忽略了什么?我最初有一个更复杂的 fetchXML 请求,但尽可能简单以消除可能的问题。
在此先感谢您的帮助!
如果你想对 Web API 端点执行 FetchXML 查询,正确的语法是这个(jQuery 示例,但你可以看到端点 url):
var originalFetchXML = '<fetch top="5" ><entity name="account" ><attribute name="accountid" /><attribute name="name" /></entity></fetch>';
var escapedFetchXML = encodeURIComponent(originalFetchXML);
$.ajax({
type: "GET",
url: Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.1/accounts?fetchXml=" + escapedFetchXML,
async: true,
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Content-Type": "application/json; charset=utf-8",
"Accept": "application/json",
"Prefer": "odata.include-annotations=*"
},
success: function (data, textStatus, xhr) {
var results = data;
console.log(results);
},
error: function (xhr, textStatus, errorThrown) {
console.log(xhr);
}
});
您没有写出执行查询所使用的确切语言,但如果是 JavaScript (Xrm.WebApi、Fetch API、jQuery 或 XHR ) 你可以使用Dataverse REST Builder来生成它,执行Fetch XML是在Predefined Query
请求类型和Query Type
作为FetchXML