public async Task<List> GetZoomRecordingsAsync(string accessToken)
{
using (var client = new HttpClient())
{
try
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Bearer”, accessToken);
var zoomRecordingSearchDateFrom = dateTimePickerZoomFrom.Value.ToString(“yyyy-MM-dd”);
var zoomRecordingSearchDateTo = dateTimePickerZoomTo.Value.ToString(“yyyy-MM-dd”);
var recordings = new List();
string nextPageToken = “”;
do
{
var requestUrl = $"recordings?from={zoomRecordingSearchDateFrom}&to={zoomRecordingSearchDateTo}&page_size=300&next_page_token={nextPageToken}";
Log($"Request URL: {requestUrl}");
var response = await client.GetAsync(requestUrl);
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
throw new Exception($"Error fetching recordings: {response.StatusCode} - {content}");
}
var jsonResponse = JObject.Parse(content);
var meetingsArray = (JArray)jsonResponse["meetings"];
recordings.AddRange(meetingsArray.Select(Recording.ParseRecording).Where(r => r != null));
// Get next_page_token
nextPageToken = jsonResponse["next_page_token"]?.ToString();
} while (!string.IsNullOrEmpty(nextPageToken));
return recordings;
}
catch (Exception ex)
{
Log($"Exception caught: {ex.Message}");
throw;
}
}
"
Thanks for the help and let me know if you have any questions!
These can only be requested in periods of one month. You’ll just need to loop through & handle responses for each month. From the List all recordings docs:
The start date in ‘yyyy-mm-dd’ UTC format for the date range where you would like to retrieve recordings. The maximum range can be a month. If no value is provided for this field, the default will be current date.
For example, if you make the API request on June 30, 2020, without providing the from and to parameters, by default the value of ‘from’ field will be 2020-06-30 and the value of the ‘to’ field will be 2020-07-01.
Note: The trash files cannot be filtered by date range and thus, the from and to fields should not be used for trash files.
Examples: 2020-06-30
What about this -
public async Task<List<Recording>> GetZoomRecordingsAsync(string accessToken)
{
using (var client = new HttpClient())
{
try
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
// Set the 'from' date to the first day of the current month
var zoomRecordingSearchDateFrom = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToString("yyyy-MM-dd");
// Set the 'to' date to the first day of the next month
var zoomRecordingSearchDateTo = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).ToString("yyyy-MM-dd");
var recordings = new List<Recording>();
string nextPageToken = "";
do
{
var requestUrl = $"recordings?from={zoomRecordingSearchDateFrom}&to={zoomRecordingSearchDateTo}&page_size=300&next_page_token={nextPageToken}";
Log($"Request URL: {requestUrl}");
var response = await client.GetAsync(requestUrl);
var content = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
throw new Exception($"Error fetching recordings: {response.StatusCode} - {content}");
}
var jsonResponse = JObject.Parse(content);
var meetingsArray = (JArray)jsonResponse["meetings"];
recordings.AddRange(meetingsArray.Select(Recording.ParseRecording).Where(r => r != null));
// Get next_page_token
nextPageToken = jsonResponse["next_page_token"]?.ToString();
} while (!string.IsNullOrEmpty(nextPageToken));
return recordings;
}
catch (Exception ex)
{
Log($"Exception caught: {ex.Message}");
throw;
}
}
}