Zoom Meeting API Returns Incorrect Dates

I trying to get all the zoom recordings to download, but for some reason the response is coming back with dates I didn’t set.

I’m wondering if Zoom is only returning a subset of what I’m requesting, perhaps due to paging?

Here is my request url:

from=2022-01-01&to=2022-12-31

as you can see I’m essentially requesting all of 2022, but here is what I back in my json request:

from: “2022-11-30”
from: “2022-11-30”
page_count: 1
page_size: 300
total_records: 14
next_page_token: “”

Here’s an example of my C# code:

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!

Steve

Hey @steve3, welcome, thanks for posting :wave:

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;
        }
    }
}

Thanks @michael.zoom ,

One problem is that next_page_token: “” is blank

All the other data is there and the search string was for an entire year.

Why is that?

@steve3 , are the total records greater than the page size, but the next_page_token is still blank?