Closed jonquandt closed 3 months ago
Would be nice to also have the packages API return 404 when the resource does not exist.
e.g.
curl 'https://api.govinfo.gov/packages/BILLSTATUS-118hr8386/xml?api_key=<API_KEY>&format=json'
Response: 400
{
"message": "The requested resource does not exist."
}
@ryparker - we can look at improving the error reporting for that situation as well, though the format
parameter is not one that's supported by the GovInfo API - your request is asking for a BILLSTATUS package using the xml endpoint (/packages/BILLSTATUS-118hr8386/xml
) and then using a parameter that is invalid/not expected.
BILLSTATUS packages are currently not available in JSON. You can see what formats are available in the /summary endpoint.
https://api.govinfo.gov/packages/BILLSTATUS-118hr8386/summary?api_key=DEMO_KEY
As part of our effort to make the BILLSUM collection available via the API, I realized that our BILLSTATUS and ECFR collections are returning /bulkdata links instead of /packages/packageId
/xml links. For consistency, we will be updating that in the future so that things are more consistent with other collections.
though the format parameter is not one that's supported by the GovInfo API
oops! Removing that param resolved the resource as expected.
As part of our effort to make the BILLSUM collection available via the API, I realized that our BILLSTATUS and ECFR collections are returning /bulkdata links instead of /packages/packageId/xml links. For consistency, we will be updating that in the future so that things are more consistent with other collections.
Excellent! Thanks for prioritizing this.
@ryparker - FYI - the error code issue is not resolved, BILLSUM is now available via the API, and BILLSTATUS xmlLinks are now using the standard API pattern.
Requests to the API related service for a relationship to a specific accessid for a specific collection are returning the standard error message, but with a 200 HTTP status code instead of the appropriate 404 code.
For example, https://api.govinfo.gov/related/BILLSTATUS-118hr99999/BILLS?api_key=DEMO_KEY will return the correct error message, but it will return with a 200 error code. This should return 404 instead.