Dynamics crm Dynamics 365 Web API-如何使用Web API注册webhook的步骤?

Dynamics crm Dynamics 365 Web API-如何使用Web API注册webhook的步骤?,dynamics-crm,dynamics-crm-webapi,Dynamics Crm,Dynamics Crm Webapi,我正在探索Dynamics CRM web API,并尝试注册一个webhook,当实体(如联系人/帐户)更新/创建时将触发该webhook。我可以使用PluginRegistration工具创建此设置,但我想从我的工作流中排除此工具。如果可能的话,我想注册webhook和step-through web API。我能够成功注册webhook-使用对以下端点的POST请求: /api/data/v9.0/serviceendpoints 与以下机构合作: { "name&qu

我正在探索Dynamics CRM web API,并尝试注册一个webhook,当实体(如联系人/帐户)更新/创建时将触发该webhook。我可以使用PluginRegistration工具创建此设置,但我想从我的工作流中排除此工具。如果可能的话,我想注册webhook和step-through web API。我能够成功注册webhook-使用对以下端点的POST请求:

/api/data/v9.0/serviceendpoints
与以下机构合作:

{
    "name":"Test Webhook",
    "url":"http://somewebhookendpoint.somedomain.com",
    "contract":8,
    "authtype":4,
    "authvalue":"args"
}
但是,当尝试创建
sdkmessageprocessingstep
(我假设这是我在这个webhook下尝试创建的步骤)时,我收到了
400个错误请求。这是我正在传递给sdkmessageprocessingstep创建端点的请求正文
(api/data/v9.0/sdkmessageprocessingsteps)

但是在传递这个请求时,我得到了以下错误(这似乎表明我没有以正确的格式发送
sdkmessageid

但是没有用(删除@也不起作用)。响应似乎指定我传递了一些不正确的参数:

{
    "error": {
        "code": "0x0",
        "message": "An error occurred while validating input parameters: Microsoft.OData.ODataException: Does not support untyped value in non-open type.\r\n   at System.Web.OData.Formatter.Deserialization.DeserializationHelpers.ApplyProperty(ODataProperty property, IEdmStructuredTypeReference resourceType, Object resource, ODataDeserializerProvider deserializerProvider, ODataDeserializerContext readContext)\r\n   at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ApplyStructuralProperties(Object resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)\r\n   at Microsoft.Crm.Extensibility.CrmODataEntityDeserializer.ApplyStructuralProperties(Object resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)\r\n   at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ReadResource(ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)\r\n   at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)"
    }
}

有人能帮我指定如何使用Dynamics Web API在
serviceendpoint
下注册
sdkmessageprocessingstep
吗?

可能是单值导航属性(查找)分配问题的问题,但错误消息有点不同

我还没有测试这个负载,所以请测试一下。顺便说一句,CRM REST builder在这些场景中有助于构建web api片段

{
        "name":"Test for Step Creation",
        "stage":40,
        "rank":1,
        "eventhandler_serviceendpoint@odata.bind":"/serviceendpoints(04e08d50-e63b-eb11-a813-000d3a0a7552)",
        "sdkmessageid@odata.bind":"/sdkmessages(9ebdbb1b-ea3e-db11-86a7-000a3a5473e8)",
        "sdkmessagefilterid@odata.bind": "/sdkmessagefilters(c2c5bb1b-ea3e-db11-86a7-000a3a5473e8)",
        "supporteddeployment":0,
        "description":"TEST FOR STEP CREATION #1"
}

感谢您的支持和CRM REST Builder!它正在按预期工作!:)
{
        "name":"test through json",
        "stage":40,
        "rank":1,
        "EventHandler":{"@id":"04e08d50-e63b-eb11-a813-000d3a0a7552"},
        "SdkMessage":{"@id":"9ebdbb1b-ea3e-db11-86a7-000a3a5473e8"},
        "SdkMessageFilter": {"@id":"c2c5bb1b-ea3e-db11-86a7-000a3a5473e8"},
        "description":"TEST through JSON #1"
}
{
    "error": {
        "code": "0x0",
        "message": "An error occurred while validating input parameters: Microsoft.OData.ODataException: Does not support untyped value in non-open type.\r\n   at System.Web.OData.Formatter.Deserialization.DeserializationHelpers.ApplyProperty(ODataProperty property, IEdmStructuredTypeReference resourceType, Object resource, ODataDeserializerProvider deserializerProvider, ODataDeserializerContext readContext)\r\n   at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ApplyStructuralProperties(Object resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)\r\n   at Microsoft.Crm.Extensibility.CrmODataEntityDeserializer.ApplyStructuralProperties(Object resource, ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)\r\n   at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.ReadResource(ODataResourceWrapper resourceWrapper, IEdmStructuredTypeReference structuredType, ODataDeserializerContext readContext)\r\n   at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)"
    }
}
{
        "name":"Test for Step Creation",
        "stage":40,
        "rank":1,
        "eventhandler_serviceendpoint@odata.bind":"/serviceendpoints(04e08d50-e63b-eb11-a813-000d3a0a7552)",
        "sdkmessageid@odata.bind":"/sdkmessages(9ebdbb1b-ea3e-db11-86a7-000a3a5473e8)",
        "sdkmessagefilterid@odata.bind": "/sdkmessagefilters(c2c5bb1b-ea3e-db11-86a7-000a3a5473e8)",
        "supporteddeployment":0,
        "description":"TEST FOR STEP CREATION #1"
}