Update Registrants Status - Cancel

I use /registrants/status API, and found response status = Unauthorized.
I confirm the token is okay. Do you know what goes wrong?

#region assign parameters into local parameters
string htmlTemplate = string.Empty;
Int64 webinarID = Convert.ToInt64(w.id);
string registrantID = r.ID;
string registrantEmail = r.email;
dynamic obj = new
{
action = “cancel”,
registrants = new GenericClass
{
new GenericClass { id = registrantID, email = registrantEmail }
}
};
string jsonString = JsonConvert.SerializeObject(obj, Formatting.Indented);
#endregion

Hey @it13,

Are you using a JWT or OAuth token? And, do you have the write permission to edit these registrants?

This would also need to be a PUT request to update the status; otherwise, this may return an unauthorized request method.

Phillip

1 Like

We use JWT. and we use PUT method as well. I drop the code below if it helps out.

public Zoom CancelRegistrant(Zoom z, Zoom.Registrant r, Zoom.Webinar w)
{
#region assign parameters into local parameters
string htmlTemplate = string.Empty;
Int64 webinarID = Convert.ToInt64(w.id);
string registrantID = r.ID;
string registrantEmail = r.email;
#region test
dynamic obj1 = new
{
action = “cancel”,
registrants = new GenericClass
{
new GenericClass { id = registrantID, email = registrantEmail }
}
};
string jsonString = JsonConvert.SerializeObject(obj1, Formatting.Indented);
#endregion
#endregion
#region declare bridge
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var client = new RestSharp.RestClient(“https://api.zoom.us/v2/webinars/” + webinarID + “/registrants/status”);
var request = new RestRequest(Method.PUT);
#endregion
#region declare request API
request.AddHeader(“content-type”, “application/json”);
request.AddHeader(“authorization”, z.authorization);
request.AddParameter(“application/json”, jsonString, ParameterType.RequestBody);
IRestResponse responseClass = client.Execute<Zoom.Registrant>(request);
#endregion
#region get response
if (responseClass.IsSuccessful)
{
z.isSuccessful = responseClass.IsSuccessful;
}
else
{
z.isSuccessful = false;
}
#endregion
#region output
return z;
#endregion
}

Hey @it13,

Are you cancelling registrants to a webinar you own?

Can you send all these details and the webinarID to developersupport@zoom.us so we can debug further?

Thanks,
Tommy