LibraryOfCongress / api.congress.gov

congress.gov API
601 stars 38 forks source link

/members/congress/:congress Does not return full term information #243

Open afischer opened 1 month ago

afischer commented 1 month ago

When looking at members-by-congress API at an endpoint such as https://api.congress.gov/v3/member/congress/117, members seem to have abbreviated term information. For example, Kevin McCarthy in the 117th congress terms property looks like this:

...
      "district": 20,
      "name": "McCarthy, Kevin",
      "partyName": "Republican",
      "state": "California",
      "terms": {
        "item": [
          {
            "chamber": "House of Representatives",
            "endYear": 2023,
            "startYear": 2007
          }
        ]
      },
...rest of the member object

Additionally the district property at the at the top level is for the most recent term, even if for the queried congress, the member was in a different district. This can lead to incorrect information — in the above example, Kevin McCarthy is listed as representing the 20th district, even though he was a representative to for the 23rd district in the 117th congress (prior to redistricting in 2020).

This information is already available in the /members/:bioguideId API, for example at https://api.congress.gov/v3/member/M001165, Kevin McCarthy has these two items as his last two terms:

"terms": [
   ...other terms
      {
        "chamber": "House of Representatives",
        "congress": 117,
        "district": 23,
        "endYear": 2023,
        "memberType": "Representative",
        "startYear": 2021,
        "stateCode": "CA",
        "stateName": "California"
      },
      {
        "chamber": "House of Representatives",
        "congress": 118,
        "district": 20,
        "endYear": 2023,
        "memberType": "Representative",
        "startYear": 2023,
        "stateCode": "CA",
        "stateName": "California"
      }
]

It would be great if this district information was also correct on the congress list API. As a bonus, having all terms listed out like it is in the member API would be a great addition.