LibraryOfCongress / api.congress.gov

congress.gov API
605 stars 38 forks source link

(hearing list API): returns 500 "Reverse for 'hearing_details' with keyword arguments not found" #166

Closed Andrew-Kao closed 3 months ago

Andrew-Kao commented 8 months ago

Similar issue to #129 and #162, but for the hearing API.

curl -X GET "https://api.congress.gov/v3/hearing/97?api_key=$KEY" -H "accept: application/xml"

Has response body

<?xml version="1.0" encoding="utf-8"?>
<api-root>
   <error>
      Reverse for 'hearing_detail' with keyword arguments '{'chamber': 'senate', 'congress': 97}' not found. 1 pattern(s) tried: ['v3/hearing/(?P&lt;congress&gt;(\\d+))/(?P&lt;chamber&gt;(house|senate|nochamber))/(?P&lt;jacketNumber&gt;(\\d+))(?P&lt;file_ext&gt;(\\.xml|\\.json|/))?$'] (NoReverseMatch)
   </error>
   <request>
      <congress>
         97
      </congress>
      <contentType>
         application/xml
      </contentType>
      <format>
         xml
      </format>
   </request>
</api-root>

This occurs for Congress 97-103, as well as in 109.

mnewatloc commented 8 months ago

We have hearings from the 103rd Congress forward: https://www.congress.gov/help/coverage-dates However, we have found instances in other collections of items outside our coverage range. We're investigating to see if that's happening here. At any rate, the queries for the 103rd and 109th should work--we tried to recreate your issue but were unable to. We've opened a ticket for this and will follow up when we know more.

Andrew-Kao commented 8 months ago

Here's an example call that doesn't work with the 103rd Congress: curl -X GET "https://api.congress.gov/v3/hearing/103?limit=250&api_key=$KEY" -H "accept: application/xml"

Specifically, the problem appears to be with the hearing at offset 22 and offset 23: curl -X GET "https://api.congress.gov/v3/hearing/103?offset=22&limit=1&api_key=$KEY" -H "accept: application/xml" curl -X GET "https://api.congress.gov/v3/hearing/103?offset=23&limit=1&api_key=$KEY" -H "accept: application/xml" The rest of the hearings in the 103rd Congress can be retrieved regularly.

For the 109th Congress, the problem is at offset 1712 (the rest work normally).