dropOffLocations data

Skip to first unread message

Stephan Cloitre

Oct 6, 2020, 9:14:02 AM10/6/20
to Google Civic Information API
I see here that Drop Boxes data for California data is live, but when I query the api using the following request https://www.googleapis.com/civicinfo/v2/voterinfo?electionId=7000&address=' + address + '&key=<My Key>, it doesn't return anything for dropOffLocations[0].name, for example. 

I get this error message: TypeError: Cannot read property '0' of undefined (line 23, file "Code")

Here's the code. Line 23 is the one that includes dropOffLocations[0].name

 address = '3015 SACRAMENTO AVE ACTON,CA 935100';
   var request = 'https://www.googleapis.com/civicinfo/v2/voterinfo?electionId=7000&address=' + address + '&key=<My key>';
   var responses = UrlFetchApp.fetchAll(requests);

  for(var i=0; i<responses.length; i++) {
    var response = JSON.parse(responses[i].getContentText());
    var election = response.election.name;
    var DOlocation = response.dropOffLocations[0].name;

Any help is appreciated

Stephan Cloitre

Oct 6, 2020, 4:14:19 PM10/6/20
to Google Civic Information API
By the way, this works for the following address: 1822 Resort Drive, Massanutten VA 22840, so it looks like this is a data availability issue?

Arjun Talwar

Oct 14, 2020, 11:32:42 AM10/14/20
to Google Civic Information API
Hi Stephen
  1. The address you've used "address = '3015 SACRAMENTO AVE ACTON,CA 935100';" has a wrong Pin code and is also not a residential address because of which the API is not returning a response you expect.
  2. The API expects a valid residential address and does not work with other addresses.
  3. Please also note that not all counties are live! in California. You can find the detail if you hover over the cell and look at the comment attached to the Live! cell in the California row (see sheet)
Hope this helps!


Stephan Cloitre

Oct 14, 2020, 11:42:52 AM10/14/20
to Google Civic Information API
Thank you
Reply all
Reply to author
0 new messages