类似于此论坛帖子: https ://developer.citrixonline.com/forum/request-not-expected-format
然而,他并没有真正解释他发现他的代码有什么问题。
我正在使用 RestSharp 进行 API 调用。我已经能够很好地提取即将举行的网络研讨会列表,但是当我尝试注册参与者时,我不断收到 400/Request not in expected format 错误。
按照此文档https://developer.citrixonline.com/api/gotowebinar-rest-api/apimethod/create-registrant,这是我的代码:
var client = new RestClient(string.Format("https://api.citrixonline.com/G2W/rest/organizers/{0}/webinars/{1}/registrants", "300000000000xxxxxx", btn.CommandArgument));
var request = new RestRequest(Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddHeader("Accept", "application/json");
request.AddHeader("Accept", "application/vnd.citrix.g2wapi-v1.1+json");
request.AddHeader("Authorization", "OAuth oauth_token=" + System.Configuration.ConfigurationManager.AppSettings["GoToWebinar"]);
request.AddParameter("firstName", LoggedInUser.FirstName);
request.AddParameter("lastName", LoggedInUser.LastName);
request.AddParameter("email", LoggedInUser.Email);
var response = client.Execute(request);
var statusCode = response.StatusCode;
关于如何弄清楚为什么我不断收到该错误的任何见解?
谢谢!