我已在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库。
答案 0 :(得分:0)
除了提到有效载荷格式的不一致规范之外,您的代码/有效载荷包含很少的错误。
例如, expirationTime 信息必须在有效负载主体中提供,而不是作为请求标头的一部分。 此外,与会者和领导者应该是数组..
我建议你仔细阅读并仔细阅读 myOnlineMeetings resource
答案 1 :(得分: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)