似乎无法在任何地方找到此错误的答案,这就是我正在尝试做的事情。
当我向 CRM api 端点发出请求时,我在编写代码 (PHP) 之前使用 postman 测试 API https://orgname.crm.dynamics.com/api/data/v8 .2/accounts
我不断收到以下错误:
{
"error": {
"code": "",
"message": "Requested API Version 'v8.2' is not available",
"innererror": {
"message": "Requested API Version 'v8.2' is not available",
"type": "Microsoft.Crm.CrmHttpException",
"stacktrace": " at Microsoft.Crm.Extensibility.OData.CrmODataRoutingConvention.ValidateApiVersion(Version version, IOrganizationContext context, String versionStr)\r\n at Microsoft.Crm.Extensibility.OData.CrmODataRoutingConvention.SelectController(ODataPath odataPath, HttpRequestMessage request)"
}
}
}
有什么想法吗?
这是 postman 请求
授权:
POST /64aa16ab-5980-47d5-a944-3f8cc9bbdfa2/oauth2/token HTTP/1.1
Host: login.windows.net
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
grant_type=password&client_secret=<<secret>>&client_id=<<id>>&resource=https%3A%2F%2F<<orgname>>.crm.dynamics.com%2F&username=<<user>>&password=<<password>>
端点:
GET /api/data/v8.2/accounts HTTP/1.1
Host: <<orgname>>.crm.dynamics.com
Accept: application/json
OData-MaxVersion: 4.0
OData-Version: 4.0
Authorization: Bearer <<token>>
Cache-Control: no-cache
我发现的一个相关问题,认为我使用的版本已被弃用:microsoft crm 2016 api version auto-discovery
感谢您的帮助!
最佳答案
看来我使用了错误的网址,
这是我应该使用的网址 https://<<orgname>>.api.crm.dynamics.com/api/data/v8.1/
在这里可以找到它:
进入Settings > Customization > Customizations > Developer Resources
。您的网址是 Service Root URL
旁边的网址
关于php - Dynamics CRM API 不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41513883/