PageRenderTime 57ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/docs/api.legislators.rst

https://github.com/runderwood/openstates
ReStructuredText | 370 lines | 331 code | 39 blank | 0 comment | 0 complexity | 9b4e38aa8fdc8c1964c46451df4d3276 MD5 | raw file
  1. ======================
  2. Legislator API Methods
  3. ======================
  4. .. contents::
  5. :depth: 2
  6. :local:
  7. Legislator Fields
  8. =================
  9. All legislator methods return Legislator objects consisting of the following fields:
  10. * ``leg_id``: A permanent, unique identifier for this legislator
  11. within the Open State Project system.
  12. * ``full_name``
  13. * ``first_name``
  14. * ``last_name``
  15. * ``middle_name``
  16. * ``suffixes``
  17. * ``photo_url``
  18. * ``active`` Whether this legislator is currently serving
  19. * ``state``, ``chamber``, ``district``, ``party`` (only present if the legislator is
  20. currently serving)
  21. * ``roles``: A list of objects representing roles this legislator
  22. has held. Each role will contain at least the ``type`` and
  23. ``term`` roles:
  24. * ``type`` the type of role - e.g. "member", "committee member",
  25. "Lt. Governor"
  26. * ``term`` the term the role was held during
  27. * ``chamber``
  28. * ``district``
  29. * ``party``
  30. * ``committee``
  31. * ``term``
  32. * ``sources``
  33. List of sources that this data was collected from.
  34. * ``url``: URL of the source
  35. * ``retrieved``: time at which the source was last retrieved
  36. .. note::
  37. ``sources`` and ``roles`` are not included in the legislator search response.
  38. .. note::
  39. Keep in mind that these documented fields may be a subset of the fields provided for a given state. (See :ref:`extrafields`)
  40. Legislator Search
  41. =================
  42. Searches for legislators matching certain criteria.
  43. Parameters
  44. ----------
  45. ``state``
  46. Filter by state served in (two-letter state abbreviation)
  47. ``first_name``, ``last_name``
  48. Filter by name
  49. ``chamber``
  50. Filter by legislator's chamber, i.e. 'upper' or 'lower'.
  51. ``active``
  52. Restrict the search to currently-active legislators (the default) - 'true' or 'false'.
  53. ``term``
  54. Filter by legislators who served during a certain term.
  55. ``district``
  56. Filter by legislative district.
  57. ``party``
  58. Filter by the legislator's party, e.g. 'Democratic' or 'Republican'.
  59. URL format
  60. ----------
  61. :samp:`http://openstates.sunlightlabs.com/api/v1/legislators/?{SEARCH-PARAMS}&apikey={YOUR_API_KEY}`
  62. Example
  63. -------
  64. http://openstates.sunlightlabs.com/api/v1/legislators/?state=ca&party=democratic&first_name=Bob&active=true&apikey=YOUR_API_KEY
  65. ::
  66. [
  67. {
  68. "first_name": "Bob",
  69. "last_name": "Blumenfield",
  70. "middle_name": "",
  71. "district": "40",
  72. "created_at": "2010-07-09 17:19:48",
  73. "updated_at": "2010-08-30 21:41:37",
  74. "chamber": "lower",
  75. "state": "ca",
  76. "nimsp_candidate_id": null,
  77. "votesmart_id": "104387",
  78. "full_name": "Blumenfield, Bob",
  79. "leg_id": "CAL000088",
  80. "party": "Democratic",
  81. "photo_url": "http://www.assembly.ca.gov/images/members/40.jpg",
  82. "active": true,
  83. "id": "CAL000088",
  84. "suffixes": ""
  85. }
  86. ]
  87. Legislator Lookup
  88. =================
  89. Lookup all available data for a legislator given their Open State Project ``leg_id``.
  90. URL Format
  91. ----------
  92. :samp:`http://openstates.sunlightlabs.com/api/v1/legislators/{LEG_ID}/?apikey={YOUR_API_KEY}`
  93. Example
  94. -------
  95. http://openstates.sunlightlabs.com/api/v1/legislators/MDL000210/?apikey=YOUR_API_KEY
  96. ::
  97. {
  98. "first_name": "Verna L.",
  99. "last_name": "Jones",
  100. "middle_name": "",
  101. "roles": [
  102. {
  103. "term": "2007-2010",
  104. "end_date": null,
  105. "district": "44",
  106. "chamber": "upper",
  107. "state": "md",
  108. "party": "Democratic",
  109. "type": "member",
  110. "start_date": null
  111. },
  112. {
  113. "term": "2007-2010",
  114. "committee_id": "MDC000003",
  115. "chamber": "upper",
  116. "state": "md",
  117. "subcommittee": null,
  118. "committee": "BUDGET & TAXATION COMMITTEE",
  119. "type": "committee member"
  120. },
  121. {
  122. "term": "2007-2010",
  123. "committee_id": "MDC000007",
  124. "chamber": "upper",
  125. "state": "md",
  126. "subcommittee": "PUBLIC SAFETY, TRANSPORTATION & ENVIRONMENT SUBCOMMITTEE",
  127. "committee": "BUDGET & TAXATION COMMITTEE",
  128. "type": "committee member"
  129. },
  130. {
  131. "term": "2007-2010",
  132. "committee_id": "MDC000019",
  133. "chamber": "upper",
  134. "state": "md",
  135. "subcommittee": null,
  136. "committee": "SPECIAL COMMITTEE ON SUBSTANCE ABUSE",
  137. "type": "committee member"
  138. }
  139. ],
  140. "district": "44",
  141. "state": "md",
  142. "created_at": "2010-08-27 22:54:37",
  143. "updated_at": "2010-08-31 22:45:34",
  144. "chamber": "upper",
  145. "leg_id": "MDL000210",
  146. "sources": [
  147. {
  148. "url": "http://www.msa.md.gov/msa/mdmanual/05sen/html/msa02779.html",
  149. "retrieved": "2010-08-31 21:15:55"
  150. }
  151. ],
  152. "votesmart_id": "19142",
  153. "full_name": "Verna L. Jones",
  154. "active": true,
  155. "party": "Democratic",
  156. "id": "MDL000210",
  157. "suffixes": ""
  158. }
  159. Geo Lookup
  160. ==========
  161. Lookup all legislators that serve districts containing a given geographical point.
  162. Parameters
  163. ----------
  164. ``lat``
  165. Latitude of point to use for district lookup
  166. ``long``
  167. Longitude of point to use for district lookup
  168. URL Format
  169. ----------
  170. :samp:`http://openstates.sunlightlabs.com/api/v1/legislators/geo/?lat={LATITUDE}&long={LONGITUDE}&apikey={YOUR_API_KEY}`
  171. Example
  172. -------
  173. http://openstates.sunlightlabs.com/api/v1/legislators/geo/?lat=-78.76648&long=35.81336&apikey=YOUR_API_KEY
  174. ::
  175. [
  176. {
  177. "created_at": "2010-08-03 17:14:48",
  178. "first_name": "Jennifer",
  179. "last_name": "Weiss",
  180. "middle_name": "",
  181. "suffix": "",
  182. "district": "35",
  183. "chamber": "lower",
  184. "roles": [
  185. {
  186. "term": "2009-2010",
  187. "end_date": null,
  188. "district": "35",
  189. "chamber": "lower",
  190. "state": "nc",
  191. "party": "Democratic",
  192. "type": "member",
  193. "start_date": null
  194. }
  195. ],
  196. "updated_at": "2010-09-01 01:11:12",
  197. "sources": [
  198. {
  199. "url": "http://www.ncga.state.nc.us/gascripts/members/memberList.pl?sChamber=House",
  200. "retrieved": "2010-08-31 23:53:37"
  201. }
  202. ],
  203. "state": "nc",
  204. "nimsp_candidate_id": 99623,
  205. "votesmart_id": "40966",
  206. "full_name": "Jennifer Weiss",
  207. "leg_id": "NCL000172",
  208. "party": "Democratic",
  209. "active": true,
  210. "id": "NCL000172",
  211. "suffixes": ""
  212. },
  213. {
  214. "created_at": "2010-08-03 17:14:46",
  215. "first_name": "Josh",
  216. "last_name": "Stein",
  217. "middle_name": "",
  218. "suffix": "",
  219. "district": "16",
  220. "chamber": "upper",
  221. "roles": [
  222. {
  223. "term": "2009-2010",
  224. "end_date": null,
  225. "district": "16",
  226. "chamber": "upper",
  227. "state": "nc",
  228. "party": "Democratic",
  229. "type": "member",
  230. "start_date": null
  231. },
  232. {
  233. "term": "2009-2010",
  234. "committee_id": "NCC000002",
  235. "chamber": "upper",
  236. "state": "nc",
  237. "subcommittee": null,
  238. "committee": "Appropriations on Department of Transportation",
  239. "type": "committee member"
  240. },
  241. {
  242. "term": "2009-2010",
  243. "committee_id": "NCC000008",
  244. "chamber": "upper",
  245. "state": "nc",
  246. "subcommittee": null,
  247. "committee": "Appropriations/Base Budget",
  248. "type": "committee member"
  249. },
  250. {
  251. "term": "2009-2010",
  252. "committee_id": "NCC000009",
  253. "chamber": "upper",
  254. "state": "nc",
  255. "subcommittee": null,
  256. "committee": "Commerce",
  257. "type": "committee member"
  258. },
  259. {
  260. "term": "2009-2010",
  261. "committee_id": "NCC000010",
  262. "chamber": "upper",
  263. "state": "nc",
  264. "subcommittee": null,
  265. "committee": "Education/Higher Education",
  266. "type": "committee member"
  267. },
  268. {
  269. "term": "2009-2010",
  270. "committee_id": "NCC000011",
  271. "chamber": "upper",
  272. "state": "nc",
  273. "subcommittee": null,
  274. "committee": "Finance",
  275. "type": "committee member"
  276. },
  277. {
  278. "term": "2009-2010",
  279. "committee_id": "NCC000012",
  280. "chamber": "upper",
  281. "state": "nc",
  282. "subcommittee": null,
  283. "committee": "Health Care",
  284. "type": "committee member"
  285. },
  286. {
  287. "term": "2009-2010",
  288. "committee_id": "NCC000014",
  289. "chamber": "upper",
  290. "state": "nc",
  291. "subcommittee": null,
  292. "committee": "Judiciary I",
  293. "type": "committee member"
  294. },
  295. {
  296. "term": "2009-2010",
  297. "committee_id": "NCC000022",
  298. "chamber": "upper",
  299. "state": "nc",
  300. "subcommittee": null,
  301. "committee": "Select Committee on Economic Recovery",
  302. "type": "committee member"
  303. },
  304. {
  305. "term": "2009-2010",
  306. "committee_id": "NCC000024",
  307. "chamber": "upper",
  308. "state": "nc",
  309. "subcommittee": null,
  310. "committee": "Select Committee on Energy, Science and Technology",
  311. "type": "committee member"
  312. }
  313. ],
  314. "updated_at": "2010-09-01 01:11:35",
  315. "sources": [
  316. {
  317. "url": "http://www.ncga.state.nc.us/gascripts/members/memberList.pl?sChamber=Senate",
  318. "retrieved": "2010-08-31 23:53:35"
  319. }
  320. ],
  321. "state": "nc",
  322. "nimsp_candidate_id": 99584,
  323. "votesmart_id": "102971",
  324. "full_name": "Josh Stein",
  325. "leg_id": "NCL000047",
  326. "party": "Democratic",
  327. "active": true,
  328. "id": "NCL000047",
  329. "suffixes": ""
  330. }
  331. ]