I am trying to update or reschedule a scheduled meeting or changing the date of a scheduled meeting to the next month in visual studio with restsharp.
This is the link of Zoom API version 2 docs:
https://marketplace.zoom.us/docs/api-reference/zoom-api/methods/#operation/meetingUpdate
I can create meeting but I cannot update the meeting. Its not working. I am new so Kindly help me.
Below is my Code:
public ActionResult EmployeeUpdate(string employee)
{
var client = new RestClient("https://api.zoom.us/v2/meetings/{MeetingId}"); //long type
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("authorization", "Bearer " "ZoomJWTToken");
request.AddJsonBody(new
{
topic = "Future Meeting",
type = 2,
start_time = "2022-03-25T6:00:00",
duration = 30,
timezone = "Asia/Tashkent",
password = "password"
});
IRestResponse response = client.Execute(request);
HttpStatusCode statusCode = response.StatusCode;
int numericStatusCode = (int)statusCode;
Assert.Equal(204, numericStatusCode);
return NoContent();
}
CodePudding user response:
This is a PATCH
request. Changing the RestRequest
should solve the problem. For more examples of how to use the API, see Postman.
Example request from Postman:
var client = new RestClient("https://api.zoom.us/v2/meetings/:meetingId?occurrence_id=<string>");
client.Timeout = -1;
var request = new RestRequest(Method.PATCH);
request.AlwaysMultipartFormData = true;
request.AddParameter("schedule_for", "<string>");
request.AddParameter("topic", "<string>");
request.AddParameter("type", "2");
request.AddParameter("start_time", "<dateTime>");
request.AddParameter("duration", "<integer>");
request.AddParameter("timezone", "<string>");
request.AddParameter("password", "<string>");
request.AddParameter("agenda", "<string>");
request.AddParameter("tracking_fields", "[{\"field\":\"<string>\",\"value\":\"<string>\"},{\"field\":\"<string>\",\"value\":\"<string>\"}]");
request.AddParameter("recurrence", "{\"type\":\"<integer>\",\"repeat_interval\":\"<integer>\",\"weekly_days\":\"1\",\"monthly_day\":1,\"monthly_week\":\"<integer>\",\"monthly_week_day\":\"<integer>\",\"end_times\":1,\"end_date_time\":\"<dateTime>\"}");
request.AddParameter("settings", "{\"host_video\":\"<boolean>\",\"participant_video\":\"<boolean>\",\"cn_meeting\":false,\"in_meeting\":false,\"join_before_host\":false,\"mute_upon_entry\":false,\"watermark\":false,\"use_pmi\":false,\"approval_type\":2,\"registration_type\":1,\"audio\":\"both\",\"auto_recording\":\"none\",\"enforce_login\":\"<boolean>\",\"enforce_login_domains\":\"<string>\",\"alternative_hosts\":\"<string>\",\"close_registration\":false,\"waiting_room\":false,\"global_dial_in_countries\":[\"<string>\",\"<string>\"],\"global_dial_in_numbers\":[{\"country\":\"<string>\",\"country_name\":\"<string>\",\"city\":\"<string>\",\"number\":\"<string>\",\"type\":\"<string>\"},{\"country\":\"<string>\",\"country_name\":\"<string>\",\"city\":\"<string>\",\"number\":\"<string>\",\"type\":\"<string>\"}],\"contact_name\":\"<string>\",\"contact_email\":\"<string>\",\"registrants_confirmation_email\":\"<boolean>\",\"registrants_email_notification\":\"<boolean>\",\"meeting_authentication\":\"<boolean>\",\"authentication_option\":\"<string>\",\"authentication_domains\":\"<string>\",\"authentication_name\":\"<string>\"}");
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);