Craig Citro | 0e5b9bf | 2014-10-15 10:26:14 -0700 | [diff] [blame] | 1 | <html><body> |
| 2 | <style> |
| 3 | |
| 4 | body, h1, h2, h3, div, span, p, pre, a { |
| 5 | margin: 0; |
| 6 | padding: 0; |
| 7 | border: 0; |
| 8 | font-weight: inherit; |
| 9 | font-style: inherit; |
| 10 | font-size: 100%; |
| 11 | font-family: inherit; |
| 12 | vertical-align: baseline; |
| 13 | } |
| 14 | |
| 15 | body { |
| 16 | font-size: 13px; |
| 17 | padding: 1em; |
| 18 | } |
| 19 | |
| 20 | h1 { |
| 21 | font-size: 26px; |
| 22 | margin-bottom: 1em; |
| 23 | } |
| 24 | |
| 25 | h2 { |
| 26 | font-size: 24px; |
| 27 | margin-bottom: 1em; |
| 28 | } |
| 29 | |
| 30 | h3 { |
| 31 | font-size: 20px; |
| 32 | margin-bottom: 1em; |
| 33 | margin-top: 1em; |
| 34 | } |
| 35 | |
| 36 | pre, code { |
| 37 | line-height: 1.5; |
| 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 | } |
| 40 | |
| 41 | pre { |
| 42 | margin-top: 0.5em; |
| 43 | } |
| 44 | |
| 45 | h1, h2, h3, p { |
| 46 | font-family: Arial, sans serif; |
| 47 | } |
| 48 | |
| 49 | h1, h2, h3 { |
| 50 | border-bottom: solid #CCC 1px; |
| 51 | } |
| 52 | |
| 53 | .toc_element { |
| 54 | margin-top: 0.5em; |
| 55 | } |
| 56 | |
| 57 | .firstline { |
| 58 | margin-left: 2 em; |
| 59 | } |
| 60 | |
| 61 | .method { |
| 62 | margin-top: 1em; |
| 63 | border: solid 1px #CCC; |
| 64 | padding: 1em; |
| 65 | background: #EEE; |
| 66 | } |
| 67 | |
| 68 | .details { |
| 69 | font-weight: bold; |
| 70 | font-size: 14px; |
| 71 | } |
| 72 | |
| 73 | </style> |
| 74 | |
| 75 | <h1><a href="civicinfo_v2.html">Google Civic Information API</a> . <a href="civicinfo_v2.representatives.html">representatives</a></h1> |
| 76 | <h2>Instance Methods</h2> |
| 77 | <p class="toc_element"> |
| 78 | <code><a href="#representativeInfoByAddress">representativeInfoByAddress(levels=None, roles=None, address=None, includeOffices=None)</a></code></p> |
| 79 | <p class="firstline">Looks up political geography and representative information for a single address.</p> |
| 80 | <p class="toc_element"> |
| 81 | <code><a href="#representativeInfoByDivision">representativeInfoByDivision(ocdId, recursive=None, roles=None, levels=None)</a></code></p> |
| 82 | <p class="firstline">Looks up representative information for a single geographic division.</p> |
| 83 | <h3>Method Details</h3> |
| 84 | <div class="method"> |
| 85 | <code class="details" id="representativeInfoByAddress">representativeInfoByAddress(levels=None, roles=None, address=None, includeOffices=None)</code> |
| 86 | <pre>Looks up political geography and representative information for a single address. |
| 87 | |
| 88 | Args: |
| 89 | levels: string, A list of office levels to filter by. Only offices that serve at least one of these levels will be returned. Divisions that don't contain a matching office will not be returned. (repeated) |
| 90 | Allowed values |
| 91 | administrativeArea1 - |
| 92 | administrativeArea2 - |
| 93 | country - |
| 94 | international - |
| 95 | locality - |
| 96 | regional - |
| 97 | special - |
| 98 | subLocality1 - |
| 99 | subLocality2 - |
| 100 | roles: string, A list of office roles to filter by. Only offices fulfilling one of these roles will be returned. Divisions that don't contain a matching office will not be returned. (repeated) |
| 101 | Allowed values |
| 102 | deputyHeadOfGovernment - |
| 103 | executiveCouncil - |
| 104 | governmentOfficer - |
| 105 | headOfGovernment - |
| 106 | headOfState - |
| 107 | highestCourtJudge - |
| 108 | judge - |
| 109 | legislatorLowerBody - |
| 110 | legislatorUpperBody - |
| 111 | schoolBoard - |
| 112 | specialPurposeOfficer - |
| 113 | address: string, The address to look up. May only be specified if the field ocdId is not given in the URL. |
| 114 | includeOffices: boolean, Whether to return information about offices and officials. If false, only the top-level district information will be returned. |
| 115 | |
| 116 | Returns: |
| 117 | An object of the form: |
| 118 | |
| 119 | { # The result of a representative info lookup query. |
| 120 | "divisions": { # Political geographic divisions that contain the requested address. |
| 121 | "a_key": { # Describes a political geography. # The unique Open Civic Data identifier for this division. |
| 122 | "officeIndices": [ # List of indices in the offices array, one for each office elected from this division. Will only be present if includeOffices was true (or absent) in the request. |
| 123 | 42, |
| 124 | ], |
| 125 | "alsoKnownAs": [ # Any other valid OCD IDs that refer to the same division. |
| 126 | # |
| 127 | # Because OCD IDs are meant to be human-readable and at least somewhat predictable, there are occasionally several identifiers for a single division. These identifiers are defined to be equivalent to one another, and one is always indicated as the primary identifier. The primary identifier will be returned in ocd_id above, and any other equivalent valid identifiers will be returned in this list. |
| 128 | # |
| 129 | # For example, if this division's OCD ID is ocd-division/country:us/district:dc, this will contain ocd-division/country:us/state:dc. |
| 130 | "A String", |
| 131 | ], |
| 132 | "name": "A String", # The name of the division. |
| 133 | }, |
| 134 | }, |
| 135 | "kind": "civicinfo#representativeInfoResponse", # Identifies what kind of resource this is. Value: the fixed string "civicinfo#representativeInfoResponse". |
| 136 | "officials": [ # Officials holding the offices listed above. Will only be present if includeOffices was true in the request. |
| 137 | { # Information about a person holding an elected office. |
| 138 | "name": "A String", # The official's name. |
| 139 | "photoUrl": "A String", # A URL for a photo of the official. |
| 140 | "phones": [ # The official's public contact phone numbers. |
| 141 | "A String", |
| 142 | ], |
| 143 | "channels": [ # A list of known (social) media channels for this official. |
| 144 | { # A social media or web channel for a candidate. |
| 145 | "type": "A String", # The type of channel. The following is a list of types of channels, but is not exhaustive. More channel types may be added at a later time. One of: GooglePlus, YouTube, Facebook, Twitter |
| 146 | "id": "A String", # The unique public identifier for the candidate's channel. |
| 147 | }, |
| 148 | ], |
| 149 | "urls": [ # The official's public website URLs. |
| 150 | "A String", |
| 151 | ], |
| 152 | "address": [ # Addresses at which to contact the official. |
| 153 | { # A simple representation of an address. |
| 154 | "city": "A String", # The city or town for the address. |
| 155 | "zip": "A String", # The US Postal Zip Code of the address. |
| 156 | "line3": "A String", # The third line of the address, if needed. |
| 157 | "line2": "A String", # The second line the address, if needed. |
| 158 | "line1": "A String", # The street name and number of this address. |
| 159 | "locationName": "A String", # The name of the location. |
| 160 | "state": "A String", # The US two letter state abbreviation of the address. |
| 161 | }, |
| 162 | ], |
| 163 | "party": "A String", # The full name of the party the official belongs to. |
| 164 | "emails": [ # The direct email addresses for the official. |
| 165 | "A String", |
| 166 | ], |
| 167 | }, |
| 168 | ], |
| 169 | "offices": [ # Elected offices referenced by the divisions listed above. Will only be present if includeOffices was true in the request. |
| 170 | { # Information about an Office held by one or more Officials. |
| 171 | "name": "A String", # The human-readable name of the office. |
| 172 | "roles": [ # The roles which this office fulfills. Roles are not meant to be exhaustive, or to exactly specify the entire set of responsibilities of a given office, but are meant to be rough categories that are useful for general selection from or sorting of a list of offices. |
| 173 | "A String", |
| 174 | ], |
| 175 | "officialIndices": [ # List of indices in the officials array of people who presently hold this office. |
| 176 | 42, |
| 177 | ], |
| 178 | "sources": [ # A list of sources for this office. If multiple sources are listed, the data has been aggregated from those sources. |
| 179 | { # Contains information about the data source for the element containing it. |
| 180 | "official": True or False, # Whether this data comes from an official government source. |
| 181 | "name": "A String", # The name of the data source. |
| 182 | }, |
| 183 | ], |
| 184 | "levels": [ # The levels of government of which this office is part. There may be more than one in cases where a jurisdiction effectively acts at two different levels of government; for example, the mayor of the District of Columbia acts at "locality" level, but also effectively at both "administrative-area-2" and "administrative-area-1". |
| 185 | "A String", |
| 186 | ], |
| 187 | "divisionId": "A String", # The OCD ID of the division with which this office is associated. |
| 188 | }, |
| 189 | ], |
| 190 | "normalizedInput": { # A simple representation of an address. # The normalized version of the requested address |
| 191 | "city": "A String", # The city or town for the address. |
| 192 | "zip": "A String", # The US Postal Zip Code of the address. |
| 193 | "line3": "A String", # The third line of the address, if needed. |
| 194 | "line2": "A String", # The second line the address, if needed. |
| 195 | "line1": "A String", # The street name and number of this address. |
| 196 | "locationName": "A String", # The name of the location. |
| 197 | "state": "A String", # The US two letter state abbreviation of the address. |
| 198 | }, |
| 199 | }</pre> |
| 200 | </div> |
| 201 | |
| 202 | <div class="method"> |
| 203 | <code class="details" id="representativeInfoByDivision">representativeInfoByDivision(ocdId, recursive=None, roles=None, levels=None)</code> |
| 204 | <pre>Looks up representative information for a single geographic division. |
| 205 | |
| 206 | Args: |
| 207 | ocdId: string, The Open Civic Data division identifier of the division to look up. (required) |
| 208 | recursive: boolean, If true, information about all divisions contained in the division requested will be included as well. For example, if querying ocd-division/country:us/district:dc, this would also return all DC's wards and ANCs. |
| 209 | roles: string, A list of office roles to filter by. Only offices fulfilling one of these roles will be returned. Divisions that don't contain a matching office will not be returned. (repeated) |
| 210 | Allowed values |
| 211 | deputyHeadOfGovernment - |
| 212 | executiveCouncil - |
| 213 | governmentOfficer - |
| 214 | headOfGovernment - |
| 215 | headOfState - |
| 216 | highestCourtJudge - |
| 217 | judge - |
| 218 | legislatorLowerBody - |
| 219 | legislatorUpperBody - |
| 220 | schoolBoard - |
| 221 | specialPurposeOfficer - |
| 222 | levels: string, A list of office levels to filter by. Only offices that serve at least one of these levels will be returned. Divisions that don't contain a matching office will not be returned. (repeated) |
| 223 | Allowed values |
| 224 | administrativeArea1 - |
| 225 | administrativeArea2 - |
| 226 | country - |
| 227 | international - |
| 228 | locality - |
| 229 | regional - |
| 230 | special - |
| 231 | subLocality1 - |
| 232 | subLocality2 - |
| 233 | |
| 234 | Returns: |
| 235 | An object of the form: |
| 236 | |
| 237 | { |
| 238 | "divisions": { # Political geographic divisions that contain the requested address. |
| 239 | "a_key": { # Describes a political geography. # The unique Open Civic Data identifier for this division. |
| 240 | "officeIndices": [ # List of indices in the offices array, one for each office elected from this division. Will only be present if includeOffices was true (or absent) in the request. |
| 241 | 42, |
| 242 | ], |
| 243 | "alsoKnownAs": [ # Any other valid OCD IDs that refer to the same division. |
| 244 | # |
| 245 | # Because OCD IDs are meant to be human-readable and at least somewhat predictable, there are occasionally several identifiers for a single division. These identifiers are defined to be equivalent to one another, and one is always indicated as the primary identifier. The primary identifier will be returned in ocd_id above, and any other equivalent valid identifiers will be returned in this list. |
| 246 | # |
| 247 | # For example, if this division's OCD ID is ocd-division/country:us/district:dc, this will contain ocd-division/country:us/state:dc. |
| 248 | "A String", |
| 249 | ], |
| 250 | "name": "A String", # The name of the division. |
| 251 | }, |
| 252 | }, |
| 253 | "officials": [ # Officials holding the offices listed above. Will only be present if includeOffices was true in the request. |
| 254 | { # Information about a person holding an elected office. |
| 255 | "name": "A String", # The official's name. |
| 256 | "photoUrl": "A String", # A URL for a photo of the official. |
| 257 | "phones": [ # The official's public contact phone numbers. |
| 258 | "A String", |
| 259 | ], |
| 260 | "channels": [ # A list of known (social) media channels for this official. |
| 261 | { # A social media or web channel for a candidate. |
| 262 | "type": "A String", # The type of channel. The following is a list of types of channels, but is not exhaustive. More channel types may be added at a later time. One of: GooglePlus, YouTube, Facebook, Twitter |
| 263 | "id": "A String", # The unique public identifier for the candidate's channel. |
| 264 | }, |
| 265 | ], |
| 266 | "urls": [ # The official's public website URLs. |
| 267 | "A String", |
| 268 | ], |
| 269 | "address": [ # Addresses at which to contact the official. |
| 270 | { # A simple representation of an address. |
| 271 | "city": "A String", # The city or town for the address. |
| 272 | "zip": "A String", # The US Postal Zip Code of the address. |
| 273 | "line3": "A String", # The third line of the address, if needed. |
| 274 | "line2": "A String", # The second line the address, if needed. |
| 275 | "line1": "A String", # The street name and number of this address. |
| 276 | "locationName": "A String", # The name of the location. |
| 277 | "state": "A String", # The US two letter state abbreviation of the address. |
| 278 | }, |
| 279 | ], |
| 280 | "party": "A String", # The full name of the party the official belongs to. |
| 281 | "emails": [ # The direct email addresses for the official. |
| 282 | "A String", |
| 283 | ], |
| 284 | }, |
| 285 | ], |
| 286 | "offices": [ # Elected offices referenced by the divisions listed above. Will only be present if includeOffices was true in the request. |
| 287 | { # Information about an Office held by one or more Officials. |
| 288 | "name": "A String", # The human-readable name of the office. |
| 289 | "roles": [ # The roles which this office fulfills. Roles are not meant to be exhaustive, or to exactly specify the entire set of responsibilities of a given office, but are meant to be rough categories that are useful for general selection from or sorting of a list of offices. |
| 290 | "A String", |
| 291 | ], |
| 292 | "officialIndices": [ # List of indices in the officials array of people who presently hold this office. |
| 293 | 42, |
| 294 | ], |
| 295 | "sources": [ # A list of sources for this office. If multiple sources are listed, the data has been aggregated from those sources. |
| 296 | { # Contains information about the data source for the element containing it. |
| 297 | "official": True or False, # Whether this data comes from an official government source. |
| 298 | "name": "A String", # The name of the data source. |
| 299 | }, |
| 300 | ], |
| 301 | "levels": [ # The levels of government of which this office is part. There may be more than one in cases where a jurisdiction effectively acts at two different levels of government; for example, the mayor of the District of Columbia acts at "locality" level, but also effectively at both "administrative-area-2" and "administrative-area-1". |
| 302 | "A String", |
| 303 | ], |
| 304 | "divisionId": "A String", # The OCD ID of the division with which this office is associated. |
| 305 | }, |
| 306 | ], |
| 307 | }</pre> |
| 308 | </div> |
| 309 | |
| 310 | </body></html> |