Search code examples
google-apis-explorergoogle-civic-information-api

OCD ID - what am I doing wrong?


The Google Civic Information API states that querying divisions is as simple as using "any parts of a OCD ID or a human readable division name" https://developers.google.com/civic-information/docs/v2/divisions/search

However, the OCD ID doesn't seem to be accepted as input to search.

Using OCD IDs as defined here: http://docs.opencivicdata.org/en/latest/proposals/0002.html

For example, using the API explorer, if I use one of the first example OCD IDs provided on the OCD website, "ocd-division/country:us/state:nc" - I'm given responses from everywhere - the first response is "American Samoa"

https://www.googleapis.com/civicinfo/v2/divisions?key=xxx&query=ocd-division/country:us/state:nc

North Carolina isn't even in the response set, and that was using a state specific OCD ID!

If I try the same search with state:tx, I get the same response. How does using something as specific as an OCD ID go this wrong?

Many OCD IDs (that I pull from the OCD site) return no data at all, or errors. I'm having very little success using the OCD ID, which I assumed would be the most accurate of searches.

What am I doing wrong?


Solution

  • OK, I feel dumb now.

    I took a break, and came back with a fresh frustration :)

    I looked at the query and thought to myself: "Self, you should put that query in quotes"

    And that's all it took.

    https://www.googleapis.com/civicinfo/v2/divisions?key=xxx&query="ocd-division/country:us/state:nc"