Error: Missing Voter_Key parameter

52 views
Skip to first unread message

Joseph Smith

unread,
Oct 31, 2023, 10:30:11 PM10/31/23
to Google Civic Information API
Hello everyone!

I am new to API's and React in general so i apologize if I misspeak or did not provide enough info but i am working on a project have a component that maps the contests array and renders the office, Candidate and party data. When using postman to test the GET request for
"https://www.googleapis.com/civicinfo/v2/voterinfo?address=3117 Kansas Ave, Norfolk, VA 23513&key=My_Key"  i get a successful response.

However, when using axios.get to fetch the same URL with the same parameters (api_Key, address) it returns this error message


"error": { "code": 400, "message": "Missing required field voter_key", "errors": [ { "message": "Missing required field voter_key", "reason": "invalid" } ], "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "description": "Missing required field voter_key" } ] } ] } }

I have gone through the documentation. I had ChatGPT go through it and look at the code, we are both stumped by this.

I appreciate it!

Joshua Richardson

unread,
Nov 5, 2023, 5:13:29 PM11/5/23
to Google Civic Information API
Just a guess.  Perhaps you are not url encoding the spaces?

Google Civic Information API

unread,
Nov 22, 2023, 4:39:44 PM11/22/23
to Google Civic Information API
Hi, thanks for the question! We recommend you review our API usage guide here and the standard errors guide here. Let us know if you have additional questions.


Thank you,
Carolyn on behalf of the Google Civic Info API team

Reply all
Reply to author
Forward
Message has been deleted
0 new messages