我試過在API瀏覽器中使用civicinfo.representatives.representativeInfoByAddress端點(https://developers.google.com/apis-explorer/?hl=en_US#p/civicinfo/v2/civicinfo.representatives.representativeInfoByAddress)。如何使用Google Civic信息API檢索給定地點的國會議員?
這是我的問題:除了美國衆議院之外,該終結點將返回所有州,聯邦和當地辦事處!我可以看到州長,參議員,州議員,但不是國會議員。我在文檔中找不到任何內容來解釋爲什麼這個顯而易見的重要數據被省略,我也不能找到這些數據的其他來源(實際上是當前的)。
爲什麼Google隱瞞國會數據,我如何得到它?這是我從這個API中需要的東西,它似乎從結果中遺漏了。我試着玩參數,但是我找不到那些數據。
必須找到這方面的信息。在谷歌API瀏覽器(見上面的鏈接)中,嘗試在「地址」字段中輸入「WA」,並將所有其他內容留空(將下一個設置爲TRUE則沒有區別,其他則只是過濾器)。以下是返回的數據:
{
"kind": "civicinfo#representativeInfoResponse",
"normalizedInput": {
"line1": "",
"city": "",
"state": "WA",
"zip": ""
},
"divisions": {
"ocd-division/country:us": {
"name": "United States",
"officeIndices": [
0,
1
]
},
"ocd-division/country:us/state:wa": {
"name": "Washington",
"officeIndices": [
2,
3,
4,
5,
6,
7,
8,
9,
10,
11
]
}
},
"offices": [
{
"name": "President of the United States",
"divisionId": "ocd-division/country:us",
"levels": [
"country"
],
"roles": [
"headOfState",
"headOfGovernment"
],
"officialIndices": [
0
]
},
{
"name": "Vice-President of the United States",
"divisionId": "ocd-division/country:us",
"levels": [
"country"
],
"roles": [
"deputyHeadOfGovernment"
],
"officialIndices": [
1
]
},
{
"name": "United States Senate",
"divisionId": "ocd-division/country:us/state:wa",
"levels": [
"country"
],
"roles": [
"legislatorUpperBody"
],
"officialIndices": [
2,
3
]
},
{
"name": "Governor",
"divisionId": "ocd-division/country:us/state:wa",
"levels": [
"administrativeArea1"
],
"roles": [
"headOfGovernment"
],
"officialIndices": [
4
]
},
{
"name": "Lieutenant Governor",
"divisionId": "ocd-division/country:us/state:wa",
"levels": [
"administrativeArea1"
],
"roles": [
"deputyHeadOfGovernment"
],
"officialIndices": [
5
]
},
{
"name": "State Auditor",
"divisionId": "ocd-division/country:us/state:wa",
"officialIndices": [
6
]
},
{
"name": "State Treasurer",
"divisionId": "ocd-division/country:us/state:wa",
"officialIndices": [
7
]
},
{
"name": "Attorney General",
"divisionId": "ocd-division/country:us/state:wa",
"officialIndices": [
8
]
},
{
"name": "Secretary of State",
"divisionId": "ocd-division/country:us/state:wa",
"officialIndices": [
9
]
},
{
"name": "Insurance Commissioner",
"divisionId": "ocd-division/country:us/state:wa",
"officialIndices": [
10
]
},
{
"name": "Commissioner of Public Lands",
"divisionId": "ocd-division/country:us/state:wa",
"officialIndices": [
11
]
},
{
"name": "State Superintendent of Public Instruction",
"divisionId": "ocd-division/country:us/state:wa",
"officialIndices": [
12
]
}
],
"officials": [
{
"name": "Donald J. Trump",
"address": [
{
"line1": "The White House",
"line2": "1600 Pennsylvania Avenue NW",
"city": "Washington",
"state": "DC",
"zip": "20500"
}
],
"party": "Republican",
"phones": [
"(202) 456-1111"
],
"urls": [
"http://www.whitehouse.gov/"
],
"photoUrl": "https://www.whitehouse.gov/sites/whitehouse.gov/files/images/45/PE%20Color.jpg",
"channels": [
{
"type": "GooglePlus",
"id": "+whitehouse"
},
{
"type": "Facebook",
"id": "whitehouse"
},
{
"type": "Twitter",
"id": "potus"
},
{
"type": "YouTube",
"id": "whitehouse"
}
]
},
{
"name": "Mike Pence",
"address": [
{
"line1": "The White House",
"line2": "1600 Pennsylvania Avenue NW",
"city": "Washington",
"state": "DC",
"zip": "20500"
}
],
"party": "Republican",
"phones": [
"(202) 456-1111"
],
"urls": [
"http://www.whitehouse.gov/"
],
"photoUrl": "https://www.whitehouse.gov/sites/whitehouse.gov/files/images/45/VPE%20Color.jpg",
"channels": [
{
"type": "GooglePlus",
"id": "+whitehouse"
},
{
"type": "Facebook",
"id": "whitehouse"
},
{
"type": "Twitter",
"id": "VP"
}
]
},
{
"name": "Maria Cantwell",
"address": [
{
"line1": "511 Hart Senate Office Building",
"city": "Washington",
"state": "DC",
"zip": "20510"
}
],
"party": "Democratic",
"phones": [
"(202) 224-3441"
],
"urls": [
"https://www.cantwell.senate.gov/"
],
"photoUrl": "http://bioguide.congress.gov/bioguide/photo/C/C000127.jpg",
"channels": [
{
"type": "Facebook",
"id": "senatorcantwell"
},
{
"type": "Twitter",
"id": "senatorcantwell"
},
{
"type": "YouTube",
"id": "SenatorCantwell"
}
]
},
{
"name": "Patty Murray",
"address": [
{
"line1": "154 Russell Senate Office Building",
"city": "Washington",
"state": "DC",
"zip": "20510"
}
],
"party": "Democratic",
"phones": [
"(202) 224-2621"
],
"urls": [
"http://www.murray.senate.gov/public/"
],
"photoUrl": "http://bioguide.congress.gov/bioguide/photo/M/M001111.jpg",
"channels": [
{
"type": "GooglePlus",
"id": "+pattymurray"
},
{
"type": "Twitter",
"id": "pattymurray"
},
{
"type": "YouTube",
"id": "SenatorPattyMurray"
},
{
"type": "Facebook",
"id": "pattymurray"
},
{
"type": "YouTube",
"id": "pattymurray"
}
]
},
{
"name": "Jay Inslee",
"address": [
{
"line1": "PO Box 40002",
"city": "Olympia",
"state": "WA",
"zip": "98504"
}
],
"party": "Democratic",
"phones": [
"(360) 902-4111"
],
"urls": [
"http://www.governor.wa.gov/"
],
"photoUrl": "http://www.governor.wa.gov/sites/default/files/images/720px-for-web_0.jpg",
"emails": [
"[email protected]"
],
"channels": [
{
"type": "Facebook",
"id": "WaStateGov"
},
{
"type": "Twitter",
"id": "GovInslee"
},
{
"type": "YouTube",
"id": "UCJhWBqWVdVnPro7tx2t7j3w"
}
]
},
{
"name": "Cyrus Habib",
"address": [
{
"line1": "PO Box 40400",
"city": "Olympia",
"state": "WA",
"zip": "98504"
}
],
"party": "Democratic",
"phones": [
"(360) 786-7700"
],
"urls": [
"http://www.ltgov.wa.gov/"
],
"photoUrl": "http://www.ltgov.wa.gov/wp-content/uploads/2017/01/Senator-Habib-2015_CROPPED-225x300.jpg",
"emails": [
"[email protected]"
],
"channels": [
{
"type": "Twitter",
"id": "waltgov"
},
{
"type": "Facebook",
"id": "Lt-Governor-Cyrus-Habib-347384975292728"
}
]
},
{
"name": "Pat (Patrice) McCarthy",
"address": [
{
"line1": "Insurance Building Capitol Campus",
"line2": "302 Sid Snyder Avenue SW",
"city": "Olympia",
"state": "WA",
"zip": "98504"
}
],
"party": "Democratic",
"phones": [
"(360) 902-0370"
]
},
{
"name": "Duane Davidson",
"address": [
{
"line1": "PO Box 40200",
"city": "Olympia",
"state": "WA",
"zip": "98504"
}
],
"party": "Republican",
"phones": [
"(360) 902-9001"
]
},
{
"name": "Bob Ferguson",
"address": [
{
"line1": "PO Box 40100",
"city": "Olympia",
"state": "WA",
"zip": "98504"
}
],
"party": "Democratic",
"phones": [
"(360) 753-6200"
],
"urls": [
"http://www.atg.wa.gov/"
],
"channels": [
{
"type": "Facebook",
"id": "WAStateAttorneyGeneral"
},
{
"type": "Twitter",
"id": "AGOWA"
}
]
},
{
"name": "Kim Wyman",
"address": [
{
"line1": "PO Box 40220",
"city": "Olympia",
"state": "WA",
"zip": "98504"
}
],
"party": "Republican",
"phones": [
"(360) 902-4151"
],
"urls": [
"http://www.sos.wa.gov/"
],
"emails": [
"[email protected]"
],
"channels": [
{
"type": "Facebook",
"id": "WaSecretaryOfState"
},
{
"type": "Twitter",
"id": "secstatewa"
}
]
},
{
"name": "Mike Kreidler",
"party": "Democratic",
"phones": [
"(360) 725-7000"
],
"urls": [
"http://www.insurance.wa.gov/"
],
"channels": [
{
"type": "Facebook",
"id": "wsoic"
},
{
"type": "Twitter",
"id": "WAinsuranceblog"
}
]
},
{
"name": "Hilary Franz",
"address": [
{
"line1": "PO Box 47000",
"city": "Olympia",
"state": "WA",
"zip": "98504"
}
],
"party": "Democratic",
"phones": [
"(360) 902-1000"
]
},
{
"name": "Chris Reykdal",
"address": [
{
"line1": "Mail stop: 47200 Old Capitol Building P.O. Box 47200",
"city": "Olympia",
"state": "WA",
"zip": "98504"
}
],
"party": "Nonpartisan",
"phones": [
"(360) 725-6115"
]
}
]
}
現在,在該JSON中對「Adam Smith」進行文本搜索。他是西澳州現任國會議員。您會注意到該字符串不存在,國會其他成員也不存在,我也不能在返回中找到任何參考鏈接來查看它們。
我在想什麼?對我來說,似乎完全瘋了,除了美國衆議院成員(但包括聯邦和州議會參議員)外,所有事情都包括在之內。這意味着有可能以某種方式獲得數據,但我只是沒有弄明白。任何人都可以幫忙嗎?
謝謝!