LibraryOfCongress / api.congress.gov

congress.gov API
605 stars 38 forks source link

member endpoint returns a total of 485 members of congress #168

Closed mirandar9936 closed 8 months ago

mirandar9936 commented 8 months ago

Using the member endpoint, I am trying to compile a list of all 535 current members of congress. However, the maximum results I get is a total of 485. I went up to an offset of 1400. Has anyone been able to acquire all 535 member names? How can I grab all 535 members? This is the endpoint I am using: https://api.congress.gov/v3/member?api_key=[INSERT_KEY]

rbram commented 8 months ago

Hello. Thanks for your question. These resources may be helpful. Legislative Documents in XML at the United States House of Representatives XML Sources Available on Senate.gov

Vacancies and changes to membership in the House of Representatives can be found at current vacancies page on the Office of the Clerk website.

cehter commented 8 months ago

@mirandar9936 How did you get the current members? I don't see any way to filter the members with the API?

mirandar9936 commented 8 months ago

Yea, it's not easy. The JSON contains another url for each member. Once you access that url, there is a key called isCurrent. If the value of that key is true, then the member is currently serving in Congress.

.Here is an easier way: This link has a CSV file already compiled with the current members of Congress: https://github.com/unitedstates/congress-legislators