0

我已经在 C# 中验证并授权了 UCWA API。应用程序 ID 也是使用生成的令牌生成的。当我尝试使用以下代码创建 lync 会议时,我收到错误“内部服务器错误”。错误:-

{"code":"ServiceFailure","message":"Your request couldn't be completed.","debugInfo":{"errorReportId":"e2c35f5e0b274c4185d08837dd7e16a3"}}

我的代码是:-

onlinemeetingURL = "https://lynctswebint.Mycompany.com/ucwa/oauth/v1/applications/101030060103/onlineMeetings/myOnlineMeetings";
    request = new RestRequest(onlinemeetingURL, Method.POST);
    request.AddHeader("Accept", "application/json");
    request.AddHeader("Host", "lynctswebint.Mycompany.com");
    request.AddHeader("expirationTime","1482572914000");
    request.AddHeader("Authorization", String.Format("{0} {1}", applicationTokenType, applicationToken));
    var applicationBody = @"""lobbyBypassForPhoneUsers"" : ""Disabled"",""phoneUserAdmission"" : ""Disabled"",""description"":""{0}"",""subject"":""{1}"",""attendees"":""{2}"",""leaders"":""{3}""";
    request.RequestFormat = DataFormat.Xml;
    request.AddParameter(
        "application/json",
       "{" + string.Format(applicationBody, "This is a test for UCWA meeting creation", "Test UCWA meeting creation", "sip:testonline.lync@Mycompany.com", "sip:lync.test@Mycompany.com") + "}",
        ParameterType.RequestBody);
    ucwaClient.ExecuteAsync(request, this.functionToCall);

没有关于此错误的更多详细信息。我为此使用了restSharp库。

4

2 回答 2

0

除了提到的关于有效负载格式的不一致规范之外,您的代码/有效负载包含很少的错误。

例如,expirationTime信息也必须在有效负载正文中提供,而不是作为请求标头的一部分。此外,与会者领导者预计将是阵列..

我建议您仔细阅读并实施
myOnlineMeetings 资源中记录的内容

于 2016-10-25T08:00:04.157 回答
0

我的代码中的以下代码段不正确。

request.AddParameter(
        "application/json",
       "{" + string.Format(applicationBody, "This is a test for UCWA meeting creation", "Test UCWA meeting creation", "sip:testonline.lync@Mycompany.com", "sip:lync.test@Mycompany.com") + "}",
        ParameterType.RequestBody);

在传递字符串时,我必须为与会者和领导传递阵列。我将其更正如下,现在它工作正常。

request.AddParameter("application/json", "{\r\n \"attendanceAnnouncementsStatus\":\"Enabled\",\r\n \"description\":\"This is a test for UCWA meeting creation\",\r\n \"subject\":\"Test UCWA meeting creation\",\r\n \"attendees\": [\"sip:testonline.lync@mycompany.com\"],\r\n \"leaders\": [\"sip:lync.test@mycompany.com\"]\r\n }", ParameterType.RequestBody)
于 2016-11-01T13:10:26.440 回答