Get Active Host report request not returning all data

My request to get an active host report (within a 1 day timeframe) isn’t returning all data. I’m using google script editor to store the data in a worksheet.

I’m not receiving an error message. Has anyone come across this issue before?

function getZoomMinutes() {

// Declaring variables
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[2];
var input = sheet.getRange(“A2”);
var cols = sheet.getRange(“A:C”);
var token = getJWT(apiKey, apiSecret);
var user = 0;

// Date variables
var date = new Date();
date.setDate(date.getDate() - 1);
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();

// URL required for API call
var url = ‘https://api.zoom.us/v2/report/users?from=’ + year + ‘-’ + month + ‘-’ + day + ‘T00:00:00Z&to=’ + year + ‘-’ + month + ‘-’ + day + ‘T23:59:59Z&type=active&page_size=300’;

// API parameters
var headers = {
‘Authorization’: ‘Bearer’ + token + ’ ’
};
var params = {
headers: headers
};

// Making API call and parsing JSON response
var response = UrlFetchApp.fetch(url, params);
var zoomData = JSON.parse(response);
var numUsers = zoomData.total_records;

// Clearing existing data
cols.clear();
sheet.getRange(“A1”).setValue(“Email”)
sheet.getRange(“B1”).setValue(“Talk Time”)
sheet.getRange(“C1”).setValue(“Date”)

// Looping through records returned and writing to the Google Sheet
for(user = 0; user < numUsers; user++) {
input.offset(user, 0).setValue(zoomData.users[user].email);
input.offset(user, 1).setValue((zoomData.users[user].meeting_minutes/zoomData.users[user].participants)*zoomData.users[user].meetings);
input.offset(user, 2).setValue(month + “/” + day + “/” + year);
user++;
}

} // END GetZoomMinutes FUNCTION

Hey @aarthur,

Thanks for joining our developer community—I’m happy to take a closer look at this for you!

Is it possible to share the full request URL you’re using (with the variable values included) with me here, as well as what you’re expecting to see in the response but aren’t? This will help me look into it for you.

Thanks!
Will

Hi Will,

Thanks for your help! Here is the full request URL:

https://api.zoom.us/v2/report/users?from=2020-10-19T00:00:00Z&to=2020-10-19T23:59:59Z&type=active&page_size=300

Here’s what the response should be: https://drive.google.com/file/d/1sswR1KR0XLHyubtucNbZTiK9vIfUelFF/view?usp=sharing

And here’s what I’m currently getting: https://drive.google.com/file/d/1D9kY9JH6u-5SPyI-qpW9JvkZ1Lo_fcKZ/view?usp=sharing

I’m getting 131 unique users when I should get 262.

Hi @aarthur,

I see—thank you for providing these details!

I believe that the issue here is a result of the value you’re passing for the to/from fields. This API endpoint supports date, not technically date-time which you appear to be passing:
image

You will need to set the to parameter to at least the next day in order to capture all potential activity.

I hope this helps to clarify, but let me know if you have questions about this.

Thanks,
Will

@will.zoom I tested these changes and there was no difference in the outcome. Each time I run a test, I get exactly half of the number of unique users as is the expected outcome. Does this indicate any particular problem to you?

Hey @aarthur,

Can you share the request/response you get after using date and adding at least a day to your to/from parameters?

Thanks,
Will