Microsoft Dynamics - 网络 API

Microsoft Dynamics - Web API

我正在尝试通过 Web API.

在 by Dynamics 365 实例中创建一个新的 "incident"(案例)

在我的http请求中,我不知道哪些字段是必填的。我试图只添加标题、主题和客户,但我返回了一个 Http 400 错误...

我正在使用 Postman,试试我的 Http 请求。如果我发送以下 json

{
    "title": "Case created from Web api",
    "_customerid_value": "bb2b6a80-7102-e711-8101-3993bb354ff0"
}

但是我有错误:"CRM do not support direct update of Entity Reference properties, Use Navigation properties instead."

所以我尝试使用@data.bind 技巧 (https://msdn.microsoft.com/en-us/library/gg328090.aspx#Anchor_3)

{
    "title": "Case created from Web api",
    "customerid@odata.bind": "/contacts(bb2b6a80-7102-e711-8101-3993bb354ff0)"
}

我收到以下错误:"An undeclared property 'customerid' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values."

所以现在我真的不知道该怎么做。我们可以通过 Web API 创建事件(在我的例子中是 "service Case")吗?

谢谢

找到解决方案。只需要添加 "_contact" 到 @odata 实例。

{
    "title": "Case created from Web api",
    "customerid_contact@odata.bind": "/contacts(bb2b6a80-7102-e711-8101-3993bb354ff0)"
}